Wednesday, 11 April 2018

Truncate Vs Delete

What is the difference between truncate and delete?


  1.  Truncate deletes all records at once unconditionally, whereas delete can delete the records conditionally or unconditionally.
  2. Deleted data by truncate command can not be rolled back, whereas deleted data by delete command can be rolled back.
  3. Memory will be released after deletion of record by truncate command whereas memory will not be released after deletion of record by deleted command.
  4. Truncate is a DDL command, whereas delete is DML command.
  5. Trigger does not get fired in case of  TRUNCATE whereas triggers get fired in case of a DELETE command.
  6. We can not TRUNCATE a table if table have any foreign key constraint. We need to remove the constraint  then truncate the table and recreate the constraint.

No comments:

Post a Comment