Search code examples
mysqlsqlmultiple-tablesdrop-table

Drop multiple tables in one shot in MySQL


How to drop multiple tables from one single database at one command. something like,

> use test; 
> drop table a,b,c;

where a,b,c are the tables from database test.


Solution

  • We can use the following syntax to drop multiple tables:

    DROP TABLE IF EXISTS B,C,A;
    

    This can be placed in the beginning of the script instead of individually dropping each table.