This is the common interview question for every SQL Developer and DBA position.
DELETE | TRUNCATE |
---|---|
DML (Data Manipulation Language) Command. | DDL (Data Definition Language) Command. |
It can be rollback. | It can't be rollback. |
Using DELETE we can remove some or all records from the table. We can use WHERE clause with it. | Using TRUNCATE we can remove all records from the table at once. We can't use WHERE clause with it. |
DELETE command is slow in performance. | TRUNCATE command is super faster in performance. |
All deleted Triggers fire on DELETE command. | No Trigger can be fired on TRUNCATE command. |
DELETE can't reset high water mark. | TRUNCATE can reset high water mark. |
DELETE can't release the space from the table. | TRUNCATE can release the space from the table. |
Comments