1024programmer Mysql How does mysql delete multiple tables in batches?

How does mysql delete multiple tables in batches?

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!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-does-mysql-delete-multiple-tables-in-batches/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索