Multiple choice technology databases

Which of the following SQL statements is correct?

  1. TRUNCATE Sales TABLE

  2. TRUNCATE * FROM TABLE Sales

  3. TRUNCATE TABLE Sales

  4. All the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The correct SQL syntax for removing all rows from a table is TRUNCATE TABLE followed by the table name. This command quickly deletes all data while keeping the table structure intact. Options A and B use incorrect syntax, and D cannot be correct since only one syntax is proper.

AI explanation

The correct SQL syntax for removing all rows from a table (while keeping its structure) is TRUNCATE TABLE table_name — e.g., TRUNCATE TABLE Sales. "TRUNCATE Sales TABLE" and "TRUNCATE * FROM TABLE Sales" both have invalid word order/syntax that isn't accepted by any SQL dialect (the asterisk/FROM pattern belongs to SELECT/DELETE, not TRUNCATE, and TRUNCATE never takes a wildcard column list). "All the above" is wrong since only one of the three is syntactically valid. TRUNCATE TABLE Sales is the only correct statement.