Difference between Truncate and Delete

  1. TRUNCATE is a DDL command whereas DELETE is a DML command

  2. TRUNCATE is much faster than DELETE

  3. In case of TRUNCATE ,Trigger doesn't get fired.But in DML commands like DELETE .Trigger get fired

  4. All of the above


Correct Option: A

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) TRUNCATE is a DDL command whereas DELETE is a DML command - This option is correct. TRUNCATE is a Data Definition Language (DDL) command used to delete all the rows from a table, while DELETE is a Data Manipulation Language (DML) command used to delete specific rows from a table.

Option B) TRUNCATE is much faster than DELETE - This option is partially correct. TRUNCATE is generally faster than DELETE because it does not generate any transaction logs and does not need to record individual row deletions. However, the exact performance difference may vary depending on the specific database system and the size of the table.

Option C) In case of TRUNCATE, Trigger doesn't get fired. But in DML commands like DELETE, Trigger gets fired - This option is correct. When you use TRUNCATE, triggers associated with the table are not fired. However, when you use DELETE, triggers associated with the table may get fired.

Option D) All of the above - This option is incorrect. The correct answer is A, as explained above.

The correct answer is A. TRUNCATE is a DDL command whereas DELETE is a DML command.

Find more quizzes: