Delete and truncate both commands can be used to delete data of the table.
Delete is a DML command whereas truncate is DDL command. Truncate can be used to delete the entire data of the table without maintaining the integrity of the table. On the other hand , delete statement can be used for deleting the specific data. With delete command we can’t bypass the integrity enforcing mechanisms.
It is used to delete specific data
It is used to delete the entire data of the table
We can use with where clause
It can’t be used with where clause
It locks the table row before deleting the row
It locks the entire table
We can rollback the changes.
We can’t rollback the changes
It is slower than truncate
It is faster than delete
//TRUNCATE Query TRUNCATE TABLE tableName; //Delete DELETE FROM tableName WHERE condition;