SQL DROP DEFAULT Keyword
The DROP DEFAULT command is used to delete a DEFAULT constraint from an existing column. This removes the automatic default value that is applied when no value is specified during an insert.
SQL DROP DEFAULT Syntax
SQL Server / Oracle / MS Access:
SQL
x
1
ALTER TABLE table_name
2
ALTER COLUMN column_name DROP DEFAULT;
MySQL:
SQL
1
1
ALTER TABLE table_name
2
ALTER column_name DROP DEFAULT;
SQL DROP DEFAULT Example
SQL Server / Oracle / MS Access:
SQL
1
1
ALTER TABLE Students
2
ALTER COLUMN Course DROP DEFAULT;
MySQL:
SQL
1
1
ALTER TABLE Students
2
ALTER Course DROP DEFAULT;
Note: This command is not supported in SQLite, including our TechKubo playground. In SQLite, default values can only be set during table creation and cannot be altered or dropped afterward.