×

sql · level 1 · unit 2 · lesson 1

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

keeps only the rows that match.

Picture a sieve. Pour the whole table in, and only the rows you want stay behind. In SQL, the sieve is WHERE, and it goes after the table name.

After WHERE comes a : a test that every row either passes or fails. age = 3 passes for any pet aged exactly 3. Rows that fail are left out.

If no row passes, you still get the column names, then (no rows). That is not an error. It means nothing matched.

SELECT * FROM pets WHERE age = 3;

Here = asks a question: is the age equal to 3?