What is the difference between DELETE and TRUNCATE command?

SQL
Easy
Flipkart
106.3K views

Direct Answer

Compares row-by-row deletion with table reset, focusing on performance and rollback capabilities.

Why Interviewers Ask This

Understanding these commands is essential for database maintenance. Interviewers check if you know the performance implications and transactional differences.

How to Answer This Question

Contrast DELETE (DML, row-by-row, loggable, slower) with TRUNCATE (DDL, fast, resets identity, less logging). Mention WHERE clause capability in DELETE. Discuss rollback possibilities and trigger firing differences.

Key Points to Cover

  • Row vs Table level
  • Logging differences
  • Rollback capability
  • Performance impact

Sample Answer

DELETE removes specific rows and logs each deletion, allowing rollback and firing triggers. TRUNCATE removes all rows instantly, resetting the table structure and identity columns, but cannot be rolled back easily in som…

Common Mistakes to Avoid

  • Thinking TRUNCATE deletes data permanently
  • Ignoring trigger behavior
  • Confusing DDL and DML classifications

Sound confident on this question in 5 minutes

Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.

Try it free

Related Interview Questions

Browse all 101 SQL questionsBrowse all 138 Flipkart questions