清空数据库sql

1、清空test库中表数据:

select concat('truncate table ',table_schema,'.',table_name,';') as '执行sql' from information_schema.TABLES where table_schema='test';

2、删除test库中所有表:

select concat('drop table ',table_schema,'.',table_name,';') as '执行sql' from information_schema.TABLES where table_schema='test';

 

执行相关sql即可。

 

你可能感兴趣的:(sql)