Easy Database Systems SQL Fundamentals
What is the difference between DELETE and TRUNCATE commands?
Answer
DELETE removes rows based on condition (WHERE clause), logs each deletion for rollback, fires triggers, and is slower. TRUNCATE removes all rows, uses minimal logging (deallocates pages), doesn't fire row triggers, resets identity/auto-increment, and is faster. DELETE can be rolled back in transaction; TRUNCATE behavior varies (some DBMS support rollback). Use DELETE for selective removal, TRUNCATE for clearing entire table. Neither removes table structure.
IIT Certified
Master These Concepts with IIT Certification
175+ hours of industry projects. Get placed at Bosch, Tata Motors, L&T and 500+ companies.
Relevant for Roles
Software Engineer Backend Developer Database Administrator