Mysql删除数据库中所有表或所有表所有数据

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hjtlovelife/article/details/90731550

生成删除数据库中所有表的sql语句
SELECT concat('DROP TABLE IF EXISTS ', table_name, ';') FROM information_schema.tables WHERE table_schema = 'deleteSchema';


生成删除数据库中所有表所有数据的sql语句
select CONCAT('TRUNCATE TABLE ',table_name,';') from information_schema.tables where TABLE_SCHEMA = 'deleteSchema';

猜你喜欢

转载自blog.csdn.net/hjtlovelife/article/details/90731550