问题描述
生成删除MySQL表的sql语句。
解决方案:
#删除指定表
DROP TABLE IF EXISTS table_name;
#生成批量删除表的sql语句
##注意 databases 是删除所有表数据库名
select concat('DROP TABLE IF EXISTS databases.',table_name,';') from information_schema.tables where table_schema = 'databases'
#删除表的所有数据
##会生成日志,序号id会延续之前的编号
delete from table_name
##无日志生成,序号id重新开始
truncate table table_name