The TRUNCATE TABLE…?

  1. checks if the table has primary key specified

  2. deletes the table

  3. deletes all rows from a table

  4. None of the above


Correct Option: C

AI Explanation

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

Option A) checks if the table has primary key specified - This option is incorrect. The TRUNCATE TABLE statement does not check if the table has a primary key specified. It is used to delete all rows from a table, regardless of the presence of a primary key.

Option B) deletes the table - This option is incorrect. The TRUNCATE TABLE statement does not delete the table itself. It only deletes all rows from the table, leaving the table structure intact.

Option C) deletes all rows from a table - This option is correct. The TRUNCATE TABLE statement is used to delete all rows from a table, effectively removing all data from it. This is different from the DELETE statement, which can be used to delete specific rows or a subset of rows based on certain conditions.

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

The correct answer is C) deletes all rows from a table. This option is correct because the TRUNCATE TABLE statement is specifically used for this purpose.

Find more quizzes: