DELETE vs TRUNCATE vs DROP

    • DELETE → removes rows (can use WHERE).
    • TRUNCATE → removes all rows (faster, cannot use WHERE).
    • DROP → deletes the whole table structure.
DELETE FROM Employees WHERE id=5;   -- removes one row
TRUNCATE TABLE Employees;           -- removes all rows
DROP TABLE Employees;               -- deletes table completely

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *