INTERACTIVE LECTURES
Build and change a database
Guided class activity · apply the ideas from the full SQL lessons.
Open the detailed lessons for this activity
Detailed lessons in this module
Open the full explanations, examples, and SQL exercises directly.
Preparing for Lab 10 · After practice, try the team challenge.
Opening your saved work…
Sign in to save across devices → · Download your guest work before switching accounts.
Preview before changing rows
Step 1 of 9 · Database: Northshore Coffee
READ & UNDERSTAND
INSERT adds rows, UPDATE changes values, and DELETE removes rows. Before an UPDATE or DELETE, use a SELECT with the same WHERE condition to inspect its intended scope.
A missing WHERE can affect every row. A syntactically valid statement can therefore be a serious reasoning error. State what should remain unchanged and plan a query to check it.
This preview activity is read-only. The row-change workshops linked below use disposable exercise fixtures and check the resulting data, so you can safely practice the actual statements there.
Worked example
SELECT id, name, price FROM menu_items WHERE price < 4 ORDER BY id;
This SELECT previews the rows below four dollars. It cannot change any prices, so it is a useful first check before an UPDATE.
For the practice task, add both category and price restrictions. The verification plan should include qualifying rows and a sample or full comparison of rows that must remain unchanged.
Your question
Return id, name, and price for Tea items priced below 5, ordered by id. This is the scope preview for a proposed price change.
Explain your evidence
Which unchanged rows would you inspect afterward, and why is checking only the changed count insufficient?
Try a query to unlock the worked-answer discussion.
Query results
Predict the result, then run your query.Predict the result, then run your query.
Read-only activity · One statement per run · First 200 rows displayed · Checks compare the complete bounded result, not just this preview.
Explore this query freely in the playground ↗Check the save status above. Account-saved work is available in My Progress. Explanations are for discussion, not automatically graded. No prerequisite locks.