SQL Basic
SQL Advanced
SQL Functions
| SQL Default |
SQL DEFAULT ConstraintThe DEFAULT constraint is used to insert a default value into a column. The default value will be added to all new records, if no other value is specified. SQL DEFAULT Constraint on CREATE TABLEThe following SQL creates a DEFAULT constraint on the "City" column when the "Persons" table is created: My SQL / SQL Server / Oracle / MS Access:
The DEFAULT constraint can also be used to insert system values, by using functions like GETDATE():
SQL DEFAULT Constraint on ALTER TABLETo create a DEFAULT constraint on the "City" column when the table is already created, use the following SQL: MySQL:
SQL Server / Oracle / MS Access:
To DROP a DEFAULT ConstraintTo drop a DEFAULT constraint, use the following SQL: MySQL:
SQL Server / Oracle / MS Access: ALTER TABLE Persons |
SQL Default