SELECT only reads. INSERT, UPDATE and DELETE actually change the database — and WHERE decides how much they touch.
1 INSERT
Adds one brand-new row per VALUES list. Nothing is overwritten — the table just grows.
2 UPDATE ... SET
Rewrites values in rows that already exist. WHERE picks exactly which rows are rewritten.
3 DELETE FROM
Removes whole rows — not columns, and never the table itself.
4 The WHERE rule
UPDATE and DELETE without WHERE touch EVERY row. Read twice, run once.
Three verbs that change data
INSERT1Adds one brand-new row per VALUES list. Nothing is overwritten — the table just grows. UPDATE ... SET2Rewrites values in rows that already exist. WHERE picks exactly which rows are rewritten. DELETE FROM3Removes whole rows — not columns, and never the table itself. The WHERE rule4UPDATE and DELETE without WHERE touch EVERY row. Read twice, run once. 4 building blocks make up Three verbs that change data
Maya joins the class, her score is fixed, then a careless UPDATE hits everyone. Press play.
students currently holds six rows (ids 1-6): Ava, Ben, Chloe, Dev, Emma and Finn.
Memory
students rows= 6 — Ava to Finn
Console
output appears as the program runs…
UPDATE and DELETE are safe only when WHERE narrows them down. Follow the checks the engine makes.
process decision input / output start / end Two inserts, one sweeping UPDATE, one targeted DELETE. What does the client report?
Your predicted output — one line per console line
Hint: The UPDATE has no WHERE — count how many rows it touches before you answer the final COUNT(*).
Click a keyword, then click its job to lock the pair.
5 conceptsTap a card to expand ?INSERT INTOdrops into place
?UPDATE ... SETdrops into place
?DELETE FROMdrops into place
?WHEREdrops into place
?N rows affecteddrops into place
01INSERT adds rows, UPDATE changes them, DELETE removes them.
02A missing WHERE turns a targeted change into a table-wide one.
03"N rows affected" tells you the blast radius — check it every time.
04Changes are permanent once committed — there is no Ctrl+Z in SQL.
05Test a risky UPDATE with a SELECT that uses the same WHERE first.