Question · SQL and MySQL course · Module 5: Modifying data (DML)

TRUNCATE and WHERE

Can you add a WHERE clause to TRUNCATE to clear only some of the rows?

Answer options

  • Yes, it works exactly like DELETE with WHERE
  • Yes, but only for the id column
  • Yes, if the table has fewer than 10 rows
  • No - TRUNCATE always clears the WHOLE table

You can check the correct answer by solving this task in the CodeWorlds game.