SQL Drop Table
On this page
SQL DROP TABLE
The DROP TABLE statement permanently removes a table and all of its data from the database.
Basic Syntax
DROP TABLE table_name;
Example
DROP TABLE customers;
This deletes the customers table completely.
Using IF EXISTS
To avoid errors if the table does not exist:
DROP TABLE IF EXISTS customers;
DROP TABLE vs TRUNCATE TABLE
- DROP TABLE removes the table structure and data
- TRUNCATE TABLE removes all rows but keeps the table structure
TRUNCATE TABLE customers;
Foreign Key Restrictions
If another table references this table via a foreign key, DROP TABLE may fail.
Some database systems allow cascading deletes:
DROP TABLE customers CASCADE;
Support for CASCADE depends on the database system.
Permissions Required
You must have sufficient privileges to drop a table.
Best Practices
- Always create a backup before dropping important tables
- Verify table dependencies (foreign keys)
- Avoid running DROP commands in production without confirmation
Common Mistakes
- Dropping the wrong table
- Confusing TRUNCATE with DROP
- Ignoring foreign key dependencies
Next Step
Continue with SQL ALTER TABLE to learn how to modify existing tables.