Check data before trusting a query
See this course’s project requirements
Answer whether one assigned workshop session can accommodate six additional bookings using your accumulated query collection.
Keep your working files in your own notebook or software. Save a private description, checklist, and work link in My Proof.
What to include
- Include the complete original two-table fixture and dictionary.
- Show filtering, ordering and grouped summaries with expected results.
- Demonstrate both session-preserving and venue-preserving joins.
- Detect an invalid test record and record missing-data limits.
- Deliver the decision query with reproducible output and interpretation.
Review and revise
Use these criteria to check your work and choose what to improve.
- Question fit: row and group meanings match the decision.
- Query correctness: results follow from explicit SQL or accurate traces.
- Quality: totals reconcile and missing matches are explained.
- Reproducibility: fixture, queries and limits travel with the answer.
Want more background?
The idea in everyday life
The fixture is intentionally small enough to audit by hand. Real datasets can contain inconsistent counts or missing codes even when a query runs without errors. You will build a quality note that distinguishes invalid values from unresolved information. Practice occurs in a separate copy, so learning to find defects never requires changing operational records.
A correct query can still answer from incorrect or incomplete data.
One step at a time.
Use the sample or information you have permission to use. Keep your work as you go. You can pause between steps.
- 1
Define three rules: session IDs are unique, counts are nonnegative, and booked must not exceed seats. Treat an unassigned venue as a separate unresolved issue rather than an arithmetic error.
- 2
Query for seats < 0 OR booked < 0 OR booked > seats. The original fixture should return no rows. On paper, test the same condition against each record.
- 3
In a separate scratch copy or written test table, create row 9 with seats=5 and booked=7. Confirm that your check selects it. Do not overwrite the original fixture used for earlier reconciliations.
- 4
Use site IS NULL to find unassigned sessions. Explain why site = NULL is not a reliable equality check: NULL is an unknown value and has special comparison behavior.
- 5
Record the defect, affected question and owner action. Do not silently change booked from seven to five: that would manufacture a correction without evidence. Keep the quality report with your queries.
See how it works.
Fictional audit queries:
SELECT id FROM sessions
WHERE seats < 0 OR booked < 0 OR booked > seats;
SELECT id FROM sessions WHERE site IS NULL;The first query returns no original rows. The second returns id 4, identifying a missing assignment. If a separate test row (9,'A',5,7) is added, the first query returns 9 because seven bookings exceed five seats. That result does not tell us whether capacity or bookings is wrong. The quality note says to verify the source record before correction and to withhold capacity claims for that defective row in a live decision.
Did you cover these?
- The original count check returns no rows.
- The planted overbooking row is detected.
- Missing venue uses IS NULL.
What to finish
A quality-check query collection and defect note using a separate test row.
Watch for this
Turning an uncertain value into a convenient value without verified evidence.
How can I tell I understand it?
Detect a planted defect and distinguish its symptom from its cause.
Quick knowledge check
Answer all 3 questions. Get at least 2 right and the lesson completes automatically.
You’ll get an explanation for each answer. Signed in? Your results save to your account.
Pass the check. We’ll save the progress.
Answer all 3 questions above and get at least 2 right. You can review the explanations and try again.
Go to the knowledge checkTools, templates, and lesson sources
Tools and templates
Tools open in a new tab so you can keep your place here.
Sources and further reading
Explore the references behind this lesson.
Source & access notes · checked 2026-09-10
Opened university OpenCourseWare overview; verified querying, relationships, design and optimization topics. Used as optional further study, with original fixtures here.
Access: Free OpenCourseWare reading and videos. External grading or progress services may require accounts; optional verified certificates have separate enrollment and may be paid. This course awards no Harvard credit or affiliation.
Reuse: Linked for reference. Examples, activities and assessments here are original; free access alone does not grant permission to reuse source text or branding.
Source & access notes · checked 2026-09-10
Opened official SELECT documentation covering WHERE, GROUP BY, joins, ORDER BY and NULL behavior. All supplied queries target SQLite syntax.
Access: Free public reading; no account or certificate is required for this Life Starter course.
Reuse: Linked for reference. Examples, activities and assessments here are original; free access alone does not grant permission to reuse source text or branding.
Source & access notes · checked 2026-09-10
Opened official table-definition documentation including keys and constraints. Tables use explicit primary keys and original nonpersonal test data.
Access: Free public reading; no account or certificate is required for this Life Starter course.
Reuse: Linked for reference. Examples, activities and assessments here are original; free access alone does not grant permission to reuse source text or branding.
Report a problem with this lesson
Tell us what went wrong. Please leave out personal information and private project contents.