Copy Code code as follows:
Select CONCAT (' drop table ', table_name, '; ')
From Information_schema.tables
Where table_name like ' dede_% ';
"Dede" for the table prefix to be deleted, executing this SQL statement generates a string of SQL statements that must be executed again to perform the delete operation
The other is to bulk modify the table name:
Copy Code code as follows:
Select CONCAT (' ALTER TABLE ', table_name, ' RENAME to ', table_name, '; ')
From Information_schema.tables
Where table_name like ' dede_% ';
This SQL statement is executed first, and the following statement is generated:
Copy Code code as follows:
ALTER TABLE de_aaa RENAME to DE_AAA;
ALTER TABLE de_bbb RENAME to DE_BBB;
In the editor, change the "RENAME to de" batch to the table prefix you want to set, and then execute this SQL statement to batch modify the table name.