Oracle Database SQL — Question 73
Which statement is true about TRUNCATE and DELETE?
Answer options
- A. For tables with multiple indexes and triggers DELETE is faster than TRUNCATE.
- B. For large tables TRUNCATE is faster than DELETE.
- C. You can never TRUNCATE a table if foreign key constraints will be violated.
- D. You can never DELETE rows from a table if foreign key constraints will be violated.
Correct answer: B
Explanation
The correct answer is B because TRUNCATE is a more efficient operation for removing all rows from large tables as it does not log individual row deletions. Option A is incorrect because DELETE is generally slower in such scenarios. Option C is misleading as TRUNCATE will fail if foreign key constraints exist, but it does not specify that it can 'never' be done. Option D is false because you can still DELETE rows if it violates foreign key constraints, but the operation will throw an error.