DROP

SQL DROP Keyword

The DROP command is used to delete database objects such as columns, tables, constraints, views, and indexes. Use DROP with caution as it permanently removes the specified object and any data associated with it.

SQL DROP COLUMN Syntax

SQL

SQL DROP COLUMN Example

SQL Server / Oracle / MS Access

Tutorials dojo strip
SQL

MySQL

SQL

Note: This command is not supported in SQLite including our TechKubo playground. SQLite does not support dropping a column directly — the table must be recreated without the column.

SQL DROP a UNIQUE Constraint Example

SQL Server / Oracle / MS Access

SQL

MySQL

SQL

Note: Dropping constraints is not supported in SQLite. Constraints must be defined during table creation and cannot be removed afterward.

SQL DROP a PRIMARY KEY Constraint Example

SQL Server / Oracle / MS Access

SQL

MySQL

SQL

Note: This will not work in SQLite. Primary key constraints cannot be dropped separately after table creation in SQLite.

SQL DROP a FOREIGN KEY Constraint Example

SQL Server / Oracle / MS Access

SQL

MySQL

SQL

Note: SQLite does not support dropping foreign keys after table creation.

SQL DROP a CHECK Constraint Example

SQL Server / Oracle / MS Access

SQL

MySQL

SQL

Note: SQLite does not support removing CHECK constraints using ALTER TABLE. They must be defined during table creation.

SQL DROP DEFAULT Example

SQL Server / Oracle / MS Access

SQL

MySQL

SQL

Note: SQLite does not support dropping default value. Defaults must be set during table creation and cannot be altered later.

SQL DROP INDEX Example

MySQL

SQL

MS Access

SQL

SQL Server

SQL

DB2 / Oracle

SQL

Note: Dropping indexes is supported in some systems.

SQLite allows dropping indexes with this command:

SQL

SQL DROP DATABASE Syntax

SQL

SQL DROP DATABASE Example

SQL

Note: This command is not supported in SQLite. In SQLite, you delete a database by deleting its file from the system manually.

SQL DROP TABLE Syntax

SQL

SQL DROP TABLE Example

SQL

SQL DROP VIEW Syntax

SQL

SQL DROP VIEW Example

This example shows how to drop a view when you created one.

SQL

SQL DROP Labs

Tutorials dojo strip