【发布时间】:2020-10-21 00:04:45
【问题描述】:
我知道听起来这个问题可能已经得到解答,但没有,我已经阅读了所有其他问题及其答案,而我的要求有所不同。 我知道 TRUNCATE 是 DDL 而 DELETE 是 DML,我知道 DELETE 可以与 WHERE 一起使用来删除一行,TRUNCATE 删除整个列,等等。
我已阅读所有这些答案: What's the difference between delete from table_a and truncate table table_a in MySQL? Difference between TRUNCATE and DELETE?
what is the difference between truncate and delete command in sql query
what is the diffrence between truncate and delete in sql server?
我要问的是这两个语句产生相同的结果吗?
DELETE FROM my_table;
与
TRUNCATE TABLE my_table;
我读得越多,我就越感到困惑,所以请说 TRUE 或 FALSE,然后请解释一下。
我知道这听起来可能很愚蠢,但帮助。
【问题讨论】:
-
我相信
delete会调用任何delete触发器,而truncate不会。 -
这个答案适用于 Oracle 还是 MySQL?这是两种截然不同的动物。