MySql 删除相同前缀的表名

SELECT 
  CONCAT('drop table ', table_name, ';') 
FROM
  information_schema.tables 
WHERE table_name LIKE '表前缀%' 
  AND table_schema = '表空间名' 

  批量修改表名:

SELECT 
  CONCAT(
    'ALTER TABLE ',
    table_name,
    ' RENAME TO ',
    table_name,
    ';'
  ) 
FROM
  information_schema.tables 
WHERE table_name LIKE 't_ci_%' ;

  

你可能感兴趣的:(MySql 删除相同前缀的表名)