The DEFAULT Constraint is used to insert the default values into a column during design time.
The default values is used in new record if no value is specified during INSERT Statement.
The default
SQL DEFAULT Constraint Syntax
Example
Users
ID | Firstname | Lastname | Salary | DeptID | DateAdded |
---|
This will set the default value into DateAdded field if no value is passed using the INSERT Statement and will give the default system date.
ALTER TABLE method
Example MySQL
Example Oracle/SQL server/MS Access
TO REMOVE DEFAULT CONSTRAINT
Example MySQL
Example Oracle/SQL Server/MS Access