Drop multiple MySQL tables

Posted in MySql -

Last week I looked at how to drop a table with MySQL showing how to do this with a query and then using the phpMyAdmin web based interface. This time I will show how to drop multiple tables with a single query and then how to do the same with phpMyAdmin.

SQL Query

Dropping multiple tables is the same as dropping a single table; additional tables are added to the DROP TABLE query in comma separated fashion. Note that running the following query to delete the example categories, products and orders table is irrecoverable and there is no prompting.

DROP TABLE categories, orders, products;

Using phpMyAdmin

To drop multiple tables in phpMyAdmin select the page which shows all the tables for a database. Tick the boxes for the tables you want to delete, and select "Drop" from the "With selected:" drop down box. This is shown in the screenshot below where all three tables have been checked: categories, orders and products.

select which tables to drop

The page will submit and a confirmation page will display asking if you really do want to drop those tables. Click "Yes" and they will be dropped.

drop table confirmation


Related posts:


Comments