Understanding DELETE, TRUNCATE and DROP Table in SQL

The DELETE, TRUNCATE, DROP Commands and when to use them in your projects. Easy Simple to Understand Table.

I wanted to explain the main differences between these commands in a table format.

Difference Between DROP, TRUNCATE and DELETE Commands

The following table shows the what are DELETE, TRUNCATE, DROP Commands and when to use them.

DROPTRUNCATEDELETE
DROP will delete entire table (both rows and structure-columns).TRUNCATE deletes all the rows in the table and structure(columns) will remain the same.DELETE is used to delete particular rows based on the condition specified in WHERE clause
Syntax:
DROP TABLE table_name
Syntax:
TRUNCATE TABLE table_name
Syntax:
DELETE FROM table_name WHERE condition
DROP is an Data Definition Language (DDL) CommandTRUNCATE is an Data Definition Language (DDL) CommandDELETE is an Data Manipulation Language (DML) Command
DROP & TRUNCATE are equal in terms of computing.TRUNCATE is faster than DELETE.DELETE is slower than TRUNCATE.
WHERE Clause is not used.WHERE Clause is not used.WHERE Clause is used.
Use this when you don’t need the table anymore.Use this when you want to empty a table.Use this when you want to delete a certain records from a table.

Here are the commands so you can use in your project.

DELETE FROM table_name where condition;

TRUNCATE TABLE table_name;