天天看點

Mysql之truncate與delete

共同點:

二者隻會删除表中的資料而不删除表的結構。

差別:

1.當删除表中的所有記錄時,truncate與不帶where限制的delete語句作用是等效的

truncate table 表名

delete from  表名

2.如果要删除表中的部分記錄隻能用delete