What is the difference between DELETE and TRUNCATE in MySQL?
Correct answer
B. DELETE allows you to specify conditions, while TRUNCATE deletes all rows.
20 views
B. DELETE allows you to specify conditions, while TRUNCATE deletes all rows.
20 views
DELETE lets you specify conditions with WHERE, while TRUNCATE removes all rows. DELETE is a DML command that removes rows one by one and can be rolled back inside a transaction; TRUNCATE is DDL — it empties the table at once, resets AUTO_INCREMENT and is much faster on large tables.
Neither removes the table structure; that is the job of DROP.
Keep preparing with more Database Management Systems MCQs on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.