The SQL DROP statement is a data definition language (DDL) command that irreversibly removes a specified database object from the catalog and deletes all data stored in that object. Depending on the object type, associated constraints, indexes, triggers, and privileges are also removed. Because the operation is destructive and typically non-recoverable without backups, most systems require elevated privileges to execute it. Many dialects provide optional clauses like IF EXISTS to avoid errors when the target object is missing, and CASCADE or RESTRICT to control whether dependent objects are dropped automatically or the statement should fail. Once executed, a DROP cannot be rolled back unless it is issued inside a transactional DDL-supporting database (for example, PostgreSQL) and the transaction is rolled back before commit.
IF EXISTS
(keyword) - Instructs the database to skip the drop and return a notice if the object does not exist.CASCADE
(keyword) - Automatically drops objects that depend on the target object.RESTRICT
(keyword) - Refuses to drop the object if other objects depend on it.object_name
(identifier) - The name of the table, database, or other object to be removed.TRUNCATE, DELETE, ALTER, CREATE, RENAME, CASCADE CONSTRAINTS
SQL-92
You can drop tables, views, indexes, sequences, schemas, functions, stored procedures, and entire databases, depending on your database privileges.
No. DELETE removes rows from a table but keeps the table structure. DROP removes the table structure and its data from the database entirely.
Add the IF EXISTS clause. The database will skip the operation and return a notice instead of throwing an error.
Most systems reclaim the space right away, but some engines may defer actual file deletion until internal maintenance operations complete.