Which statement about TRUNCATE compared with DELETE is correct?
Correct answer
D. TRUNCATE removes all rows in one operation, cannot take a WHERE clause and fires no row-level delete triggers
15 views
D. TRUNCATE removes all rows in one operation, cannot take a WHERE clause and fires no row-level delete triggers
15 views
TRUNCATE versus DELETE: TRUNCATE is a DDL-style bulk operation that deallocates pages, allows no WHERE clause, fires no per-row DELETE triggers and in many engines resets identity sequences. DELETE is DML, logs each row, supports WHERE, fires triggers and is fully rollback-able where transactions apply. Because TRUNCATE takes an exclusive lock, it is unsuitable while concurrent readers are active.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is D? Ask here and get an explanation.