Intermediate
SQL
Q52 / 100
What is the difference between "DELETE", "TRUNCATE", and "DROP" for removing data from a table?
Correct! Well done.
Incorrect.
The correct answer is B) DELETE removes rows (optionally with WHERE) and can be rolled back; TRUNCATE quickly removes all rows resetting identity counters with minimal logging; DROP removes the entire table structure
B
Correct Answer
DELETE removes rows (optionally with WHERE) and can be rolled back; TRUNCATE quickly removes all rows resetting identity counters with minimal logging; DROP removes the entire table structure
Explanation
DELETE is a row-by-row, logged operation supporting WHERE and rollback; TRUNCATE deallocates all data pages at once (faster, minimally logged) and resets auto-increment; DROP deletes the table definition entirely.
Progress
52/100