What is the difference between DELETE and TRUNCATE?

Category: SQLWhat is the difference between DELETE and TRUNCATE?
Editor">Editor Staff asked 2 years ago

What is the difference between DELETE and TRUNCATE?

1 Answers
Editor">Editor Staff answered 2 years ago

The differences are:

  • The basic difference in both is DELETE command is DML command and the TRUNCATE command is DDL.
  • DELETE command is used to delete a specific row from the table whereas the TRUNCATE command is used to remove all rows from the table.
  • We can use the DELETE command with WHERE clause but cannot use the TRUNCATE command with it.