UPDATE & DELETE
UPDATE table SET column = value WHERE condition changes
existing rows. DELETE FROM table WHERE condition removes
rows the same way.
Example: updating one specific row
UPDATE students SET score = 95 WHERE name = 'Chidi';
1 row updated.
The WHERE clause here isn't optional in practice, even
though it's technically optional in syntax — leaving it off updates
every single row in the table, not just the one you
meant. This is one of the most common, most damaging mistakes anyone
makes with SQL, and it's worth developing the habit of writing and
double-checking your WHERE clause before you even glance at
the SET or the rest of the statement. The exact same warning
applies to DELETE, with even less room for a second chance.
UPDATE students SET score = 95 WHERE name = 'Chidi';
1 row updated.