Solve “Deduplicate events with ROW_NUMBER”

Free. Runs in your browser, no install.

SQL · Keys, Schema & CTEs

DELETE vs TRUNCATE vs DROP?

Easydeletetruncatedropddl

Interview question

DELETE vs TRUNCATE vs DROP?

How to answer

DELETE

Removes selected rows.

SQL
DELETE FROM employees
WHERE department = 'HR';

TRUNCATE

Removes all rows from a table, usually with less row-by-row work than DELETE.

SQL
TRUNCATE TABLE employees;

DROP

Removes the table itself.

SQL
DROP TABLE employees;

Lock it in with a real drill

You remember an answer longer once you have used it. Try a hands-on problem on this concept.

Open related drill