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.
Reconcile an import and plan recovery
Step 3 of 9 · Database: Northshore Coffee
READ & UNDERSTAND
A reproducible import records the source, mappings, rejected rows, and validation queries. Row counts alone cannot detect duplicated amounts or incorrect identifiers.
Transactions group changes into a unit that can be committed or rolled back. Learn BEGIN, COMMIT, and ROLLBACK in the assigned desktop SQLite environment; the classroom browser runner accepts one statement at a time and manages its own read-only settings.
For a lab report, preserve the script and verification evidence. A screenshot of success is weaker than a rerunnable script that demonstrates the required invariants.
Worked example
SELECT COUNT(*) AS orders, ROUND(SUM(total_amount), 2) AS total FROM orders;
COUNT and SUM establish two different baselines: how many orders exist and the total amount represented by those orders. Both need the same source scope and units.
Grouped totals can help localize a discrepancy to a shop. They still do not prove every individual order is correct; compare identifiers and row-level values when reconciling an import.
Your question
Return shop_id and ROUND(SUM(total_amount), 2) AS total_sales, grouped and ordered by shop_id.
Explain your evidence
Could an import preserve the row count but change total sales? Give a concrete example.
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.