Repaso
EspaƱol

What happens when you run DELETE FROM users; without a WHERE clause?

Options

  1. Nothing, WHERE is required
  2. It deletes ALL rows in the table (Correct option)
  3. It deletes the table structure
  4. It deletes the first row

Answer

It deletes ALL rows in the table

Why

Without WHERE, the statement applies to every row: all users are deleted (the empty table remains).

Same danger with UPDATE users SET ... without WHERE: every row changes.

Good habits: write the WHERE first, run a SELECT with the same WHERE to check, and work inside a transaction you can roll back.

Remember

DELETE/UPDATE without WHERE affects every row.

Key terms

Practice this question in Repaso