Krunal Krunal - 2 months ago 12
MySQL Question

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.

Answer

Example:

Let's say table A has two children B and C. Then we can use the following syntax to drop all tables.

DROP TABLE IF EXISTS B,C,A;

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

Comments