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:
ALTER TABLE table_name ALTER COLUMN column_name DROP DEFAULT;
MySQL:
ALTER TABLE table_name ALTER column_name DROP DEFAULT;
SQL DROP DEFAULT Example
SQL Server / Oracle / MS Access:
ALTER TABLE Students ALTER COLUMN Course DROP DEFAULT;
MySQL:
ALTER TABLE Students 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.