DELETE
TRUANCATE
DELETE is DML Command.
TRUNCATE is DDL Command.
DELETE Command is slow
TRUNCATE is Faster
The DELETE command is used to remove specified rows from a table.
TRUNCATE removes all rows from a table.
DELETE Can be used with or without a WHERE clause
No WHERE clause is used
DELETE operation you need to COMMIT or ROLLBACK
The operation cannot be rolled back
DELETE does not reset identity of the table.
TRUNCATE Resets identity of the table.
Trigger get fired
Trigger doesn’t get fired
Syntax
DELETE
DELETE FROM table_name WHERE [condition]
e.g
DELETE FROM employee WHERE empid=100
TRUNCATE
TRUNCATE TABLE table_name
e.g
TRUNCATE TABLE employee
Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply