What is the difference between DELETE, TRUNCATE and DROP?

CommandRemovesWHERE?Can be rolled back?
DELETEChosen rowsYesYes, inside a transaction
TRUNCATEAll rows, table stays. Counter restartsNoNo
DROPThe table (structure and data)NoNo
DELETE FROM students WHERE id = 6;
TRUNCATE TABLE students;
DROP TABLE students;

TRUNCATE is faster than DELETE without WHERE. See DELETE and DROP TABLE.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.