The DROP TABLE statement permanently removes an entire table from the database — including its structure, all its data, indexes, and constraints. Once a table is dropped, everything inside it is gone and cannot be recovered without a backup.
DROP TABLE is irreversible. Unlike TRUNCATE or DELETE, it removes the table structure itself — not just the rows. Always back up important data before dropping a table.
DROP TABLE table_name;
The following permanently deletes the students table:
DROP TABLE students;
MySQL confirms with:
Query OK, 0 rows affected (0.03 sec)
The table and every row stored in it no longer exist on the server.
Attempting to drop a table that does not exist produces an error:
DROP TABLE students;
-- ERROR 1051 (42S02): Unknown table 'school.students'
Add IF EXISTS to suppress this error and make your scripts safe to run more than once:
DROP TABLE IF EXISTS students;
DROP TABLE IF EXISTS at the top of database setup scripts before recreating tables. This ensures the script works cleanly whether or not the tables already exist.
You can drop several tables in a single statement by separating the names with commas:
DROP TABLE IF EXISTS orders, order_items, payments;
MySQL drops all listed tables in one operation. The order matters if there are foreign key relationships — you must drop the child table (the one with the foreign key) before the parent table, otherwise MySQL will return a constraint error.
SET FOREIGN_KEY_CHECKS = 0; — and remember to re-enable them afterwards with SET FOREIGN_KEY_CHECKS = 1;.
These three operations are often confused. Here is the key difference:
| Operation | Removes Data | Removes Structure | Reversible |
|---|---|---|---|
DELETE | ✔ Yes (rows you choose) | ✘ No | ✔ Yes (with transaction) |
TRUNCATE | ✔ Yes (all rows) | ✘ No | ✘ No |
DROP TABLE | ✔ Yes (all rows) | ✔ Yes (entire table) | ✘ No |
DROP TABLE name; permanently deletes the table and all its data.IF EXISTS to avoid errors when the table may not exist.DELETE, dropped tables cannot be recovered without a backup.