- 语法不同. delete from 表名 后面可以跟 where 从句, truncate table 表名. 是固定写法, 后面不能跟其他从句
- 影响自增 id. truncate table 会清空表, 并且重置自增 id 为 1, 而 delete from 表, 不影响维护的自增 id 当前偏移量
- truncate table xx 不能事务回滚, delete from 可以事务回滚
- truncate table xx 没有返回值, delete from 有返回值, 返回影响行数
truncate table 和 delete from 区别
最新推荐文章于 2024-06-11 11:35:49 发布