注意,我的数据库名字是test,有个表叫data,然后我准备四个有相同前缀的表,批量删除,准备数据可以用这条sql
create table test_1201 select * from `data`;
create table test_1202 select * from `data`;
create table test_1203 select * from `data`;
create table test_1205 select * from `data`;
select concat( drop table ', group_concat(table_name) , ';' ) as statement from information_schema.tables where table_schema = 'test' and table_name like 'test_12%';
上边这条sql是显示一个sql结果,把上边执行出来的结果再执行一边就可以了。
(只要改table_schema(这是数据库的名字),跟table_name(这是数据表的名字)即可)
drop table test_1201,test_1202,test_1203;
