Skip to main content

Difference between DELETE and TRUNCATE?

Entry MySQL
Quick Answer DELETE: removes specific rows matching WHERE, logged in the transaction log, fires triggers, can be rolled back, allows WHERE filter. TRUNCATE: removes all rows instantly (no WHERE), minimal logging, resets AUTO_INCREMENT, can't be rolled back in most cases (DDL in MySQL, though InnoDB makes it transactional). TRUNCATE is much faster for emptying a table; DELETE for selective removal.

Answer

DELETE removes selected rows and is logged, while TRUNCATE removes all rows quickly and resets auto-increment but cannot be rolled back in many cases.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice