×

sql · level 1 · unit 6 · lesson 3

  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

changes values. WHERE says which rows.

Rex has had a birthday. changes the age, and WHERE name = 'Rex' makes sure only Rex's row changes.

SET names the column and its new value. To change two columns at once, put a comma between them, like SET price = 90, stock = 10.

Always write the WHERE. Without it, UPDATE changes every single row in the table, and there is no undo button.

UPDATE pets SET age = 4 WHERE name = 'Rex';
SELECT * FROM pets WHERE name = 'Rex';

Try your WHERE in a SELECT first, and when it finds the right rows, use it in the UPDATE.