How to delete multiple tables in batches in mysql: Use the “DROP TABLE” statement, just write the table names one after the other, separated by commas; the grammar format “DROP TABLE [IF EXISTS] Table name 1 [ , table name 2, table name 3 …]”.
mysql> SHOW TABLES; +--------------------+ |Tables_in_test_db| +--------------------+ |tb_emp1| |tb_emp2| |tb_emp3| +--------------------+ 2 rows in set (0.00 sec)
It can be seen from the running results that there are 3 data tables tb_emp1, tb_emp2 and tb_emp3 in the database.
Let’s delete the data tables tb_emp1 and tb_emp3, the entered SQL statement and the running results are as follows:
mysql> DROP TABLE tb_emp1 ,tb_emp3; Query OK, 0 rows affected (0.22 sec) mysql> SHOW TABLES; +--------------------+ |Tables_in_test_db| +--------------------+ |tb_emp2| +--------------------+ 1 rows in set (0.00 sec)
As you can see from the execution results, the tables named tb_emp1 and tb_emp3 no longer exist in the data table list of the test_db database, and the deletion operation is successful.
Recommended tutorial: mysql video tutorial
The above is how mysql deletes multiple tables in batches? For more details, please pay attention to other related articles on 1024programmer.com!