MySQL

1. MySQL批量删除指定前缀表

Select CONCAT( 'drop table ', table_name, ';' )
FROM information_schema.tables
Where table_name LIKE 'mytaobao_%';

执行完上方的sql后将下方的结果copy出来执行一次就会将所有前缀为“mytaobao”的表删除。

2.批量修改表名

Select CONCAT( 'ALTER TABLE ', table_name, ' RENAME TO ', table_name,';' )
FROM information_schema.tables
Where table_name LIKE 'mytaobao_%';

执行上方的sql语句,将结果copy到editplus中,Ctrl+H 将RENAME TO mytaobao替换为RENAME TO newtaobao

posted @ 2016-05-25 13:40  herowalking  阅读(160)  评论(0)    收藏  举报