mysql> select CONCAT('truncate TABLE ',table_schema,'.',TABLE_NAME, ';') from INFORMATION_SCHEMA.TABLES where table_schema in ('dd');
mysql> truncate TABLE dd.zyx_admin;
truncate TABLE dd.zyx_admin_issued;
truncate TABLE dd.zyx_band;
truncate TABLE dd.zyx_baodansq;
truncate TABLE dd.zyx_baodanzx;
truncate TABLE dd.zyx_buy_stocks;
数据库(dd)中表就被清空了
本文介绍了一种使用MySQL命令来清空指定数据库中特定表的方法。通过构建动态SQL语句,可以有效地清空数据库(例如:dd)中的多个表,如zyx_admin等。
2776

被折叠的 条评论
为什么被折叠?



