Codementor Events

Difference between delete, truncate and drop command in SQL

Published Feb 26, 2020

Delete
Delete command is a DML command, it removes rows from a table based on the condition specified in the where clause, being a DML statement we can rollback changes made by delete command.

Truncate
Truncate is a DDL command, it removes all the rows from the table and also frees the space held. It takes a lock on the table while delete command takes a lock on rows of the table.

Drop
Drop is a DDL command, it removes the complete data along with the table structure(unlike truncate command that removes only the rows).

Discover and read more posts from Rohit Kumar
get started