Copy codeThe Code is as follows:
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:
Copy codeThe Code is as follows:
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:
Copy codeThe Code is as follows:
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.