MySQL batch delete specified prefix table _ MySQL

Source: Internet
Author: User
MySQL batch deletes the specified prefix table bitsCN.com
Select CONCAT ('drop table', table_name, ';') FROM information_schema.tables Where table_name LIKE 'dede _ % ';

"Dede" is the prefix of the table to be deleted. after this SQL statement is executed, a series of SQL statements are generated. you must execute the generated SQL statements before deleting the table.

You can also modify table names in batches:

Select CONCAT ('alter table', table_name, 'Rename TO ', table_name,'; ') FROM information_schema.tables Where table_name LIKE 'dede _ % ';

First, execute this SQL statement and generate the following statement:

Alter table de_aaa rename to de_aaa; alter table de_bbb rename to de_bbb;

In the editor, change "rename to de" TO the table prefix you want TO set in batches, and then execute this SQL statement TO modify the table names in batches.

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.