Junior From PDF SQL SQL & Databases

What is the difference between TRUNCATE and DELETE? ● TRUNCATE: Deletes all rows in a table, but the table structure remains. It is faster

nd does not log individual row deletions.

  • Cannot be rolled back (in most databases).
  • Resets auto-increment counters.
  • DELETE: Deletes rows based on a condition, and can be rolled back (if using

transactions).

  • Slower compared to TRUNCATE.

Example:

DELETE FROM Employees WHERE Age < 18; -- Deletes only specific rows

TRUNCATE TABLE Employees; -- Deletes all rows

More from SQL Server Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details