What is the difference between Delete and Truncate Statement of SQL?

The DELETE Statement deletes only the rows from the table based on the condition given in the where clause or deletes all the rows from the table if no condition is specified, but does not free the space containing the table, whereas the TRUNCATE statement deletes all the rows of the table and frees up the space containing the table.

TRUNCATE requires exclusive access to the table whereas DELETE doesn’t.

TRUNCATE as compared to DELETE is faster and uses fewer system and transaction log resources.

Leave a Reply

Your email address will not be published. Required fields are marked *