0
0
SQLquery~5 mins

DELETE vs TRUNCATE behavior in SQL - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is the main difference between DELETE and TRUNCATE in SQL?
DELETE removes rows one by one and logs each deletion, allowing WHERE conditions. TRUNCATE removes all rows quickly without logging individual row deletions and cannot use WHERE.
Click to reveal answer
beginner
Can you use a WHERE clause with TRUNCATE?
No, TRUNCATE removes all rows from a table and does not support a WHERE clause.
Click to reveal answer
intermediate
Which command, DELETE or TRUNCATE, can be rolled back in a transaction?
Both DELETE and TRUNCATE can be rolled back if used inside a transaction, but TRUNCATE behavior depends on the database system.
Click to reveal answer
intermediate
Does TRUNCATE reset identity (auto-increment) counters in a table?
Yes, TRUNCATE usually resets identity counters to the seed value, while DELETE does not reset them.
Click to reveal answer
beginner
Which command is generally faster for removing all rows: DELETE or TRUNCATE?
TRUNCATE is generally faster because it deallocates data pages instead of deleting rows one by one.
Click to reveal answer
Which SQL command allows you to delete specific rows using a condition?
AALTER
BTRUNCATE
CDELETE
DDROP
What happens to the identity counter when you use TRUNCATE on a table?
AIt increments by one
BIt is deleted
CIt remains unchanged
DIt resets to the initial seed value
Which command is faster for removing all rows from a table?
ADELETE
BTRUNCATE
CUPDATE
DINSERT
Can TRUNCATE be rolled back in a transaction in all database systems?
ADepends on the database system
BNo, never
CYes, always
DOnly if used with WHERE clause
Which command logs each row deletion individually?
ADELETE
BTRUNCATE
CDROP
DCREATE
Explain the differences in behavior between DELETE and TRUNCATE commands in SQL.
Think about speed, logging, and conditions.
You got /5 concepts.
    When would you choose DELETE over TRUNCATE in managing a database table?
    Consider situations needing selective deletion or trigger activation.
    You got /4 concepts.