删除表中所有的记录
1:delete from table_name;
delete from test;
<!--EndFragment-->
2:# truncate table table_name;
<!--StartFragment-->
truncate table test;
<!--EndFragment-->
<!--EndFragment-->
本文介绍了两种清除数据库表中所有记录的方法:一是使用DELETE语句,二是使用TRUNCATE TABLE语句。DELETE语句可以更灵活地指定删除条件,而TRUNCATE TABLE则通常执行速度更快且占用系统和事务日志资源较少。
删除表中所有的记录
1:delete from table_name;
delete from test;
<!--EndFragment-->
2:# truncate table table_name;
<!--StartFragment-->
truncate table test;
<!--EndFragment-->
<!--EndFragment-->
6095

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