Which of the following SQL statements is correct?

  1. TRUNCATE Sales TABLE

  2. TRUNCATE * FROM TABLE Sales

  3. TRUNCATE TABLE Sales

  4. TRUNCATE * FROM COLUMN Sales


Correct Option: C

AI Explanation

To answer this question, you need to understand the SQL TRUNCATE statement.

The TRUNCATE statement in SQL is used to remove all the rows from a table, allowing you to delete all the data in the table while keeping the table structure intact.

Now let's go through each option to understand why it is correct or incorrect:

Option A) TRUNCATE Sales TABLE - This option is incorrect because the correct syntax for the TRUNCATE statement does not require the keyword "TABLE" after the table name. The correct syntax is simply "TRUNCATE Sales".

Option B) TRUNCATE * FROM TABLE Sales - This option is incorrect because the * symbol is not used with the TRUNCATE statement. The correct syntax is "TRUNCATE TABLE Sales" to specify the table name directly.

Option C) TRUNCATE TABLE Sales - This option is correct because it follows the correct syntax of the TRUNCATE statement. It specifies the table name "Sales" after the keyword "TABLE".

Option D) TRUNCATE * FROM COLUMN Sales - This option is incorrect because the TRUNCATE statement does not operate on individual columns. It is used to remove all rows from a table, not specific columns.

The correct answer is Option C) TRUNCATE TABLE Sales. This option is correct because it follows the correct syntax for the TRUNCATE statement, specifying the table name after the keyword "TABLE".

Find more quizzes: