What is the difference between DELETE, TRUNCATE and DROP?

IntermediateConceptMySQL
Answer

Short answer

DELETE removes rows (all, or those matching WHERE) one by one, can be rolled back and fires triggers. TRUNCATE empties the whole table instantly by recreating it — much faster, resets auto-increment, can't use WHERE, and in MySQL can't be rolled back. DROP deletes the table itself — structure and data.

Comparison

DELETE TRUNCATE DROP
Removes Some or all rows All rows The whole table
WHERE clause ✅ ❌ ❌
Speed on big tables Slow Very fast Very fast
Rollback (MySQL) ✅ inside a transaction ❌ (implicit commit) ❌
Resets AUTO_INCREMENT No Yes —
Table still exists Yes Yes No

Examples

DELETE FROM sessions WHERE created_at < NOW() - INTERVAL 30 DAY;
TRUNCATE TABLE staging_import;
DROP TABLE old_reports;

Production tips

  • Deleting millions of rows in one DELETE locks rows and bloats the undo log — delete in batches (LIMIT 10000 in a loop).
  • Take a backup (or at least CREATE TABLE x_backup AS SELECT ...) before TRUNCATE/DROP.

What to say in the interview

"DELETE is row-by-row DML that supports WHERE and rollback; TRUNCATE quickly empties a table and resets auto-increment but is DDL; DROP removes the table entirely. For big purges I delete in batches to avoid long locks."

All Databases (MySQL, PostgreSQL, MongoDB) questions Roadmap: MySQL basics

More on MySQL