SQL清空全部表数据
- 先执行select语句生成所有truncate语句
语句格式:
select CONCAT('truncate TABLE ',table_schema,'.',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where table_schema in ('数据库1','数据库2');
示例:
select CONCAT('truncate TABLE ',table_schema,'.',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where table_schema in ('test');
相关链接:
https://blog.csdn.net/iw1210/article/details/79586033
https://www.cnblogs.com/kevingrace/p/9439025.html