Tsallaka zuwa abun ciki
Justice Tech School

UPDATE

UPDATE changes values in rows that match WHERE. Always include a WHERE clause: without it every row is changed. Test with a SELECT using the same WHERE first.

Example
UPDATE students
SET score = 70
WHERE name = 'Wanjiru';

Result

1 row affected
Example
UPDATE courses
SET price = price + 1000
WHERE level = 'Beginner';

Result

4 rows affected

Exercise

Change the score.

UPDATE students  score = 90 WHERE id = 1;

Quiz Test

What happens if you forget WHERE in an UPDATE?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.