Drop Multiple Tables in MySQL
Safely dropping multiple tables at once and disabling foreign key checks if necessary.
-- Drop multiple tables in a single command DROP TABLE IF EXISTS orders, order_items, payments; -- Disable foreign key constraints temporarily to drop relational schemas SET FOREIGN_KEY_CHECKS = 0; DROP TABLE IF EXISTS parent_table, child_table; SET FOREIGN_KEY_CHECKS = 1;
Query OK, 0 rows affected (0.03 sec) Query OK, 0 rows affected (0.02 sec)