The Life Starter
0 of 6 complete0%
Course Library · Lesson 5 of 6
Digital · Guided lesson

Check data before trusting a query

About 32 minutes · 7 reading + 25 practice and checks
Time includes reading, practice, and questions. Extra videos or further study are optional.
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.
Open the full course project
Want more background?
Before you begin

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.

The idea

A correct query can still answer from incorrect or incomplete data.

Try it

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. 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. 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. 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. 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. 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.

Example

See how it works.

Fictional audit queries:

sql
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.

Check your work

Did you cover these?

  • The original count check returns no rows.
  • The planted overbooking row is detected.
  • Missing venue uses IS NULL.
Your work

What to finish

A quality-check query collection and defect note using a separate test row.

Common mistake

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.

Try 3 questions

Quick knowledge check

Answer all 3 questions. Get at least 2 right and the lesson completes automatically.

Not yet passed

You’ll get an explanation for each answer. Signed in? Your results save to your account.

1Which row violates booked <= seats?
2How should you find a missing site in SQL?
3An audit finds booked=8 and seats=6, but no correction has been confirmed. Which response preserves an evidence-based result?
0 of 3 answeredApply the lesson to a short question, then review the explanation.
5
Finish this lesson

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 check
Tools, 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.

Harvard CS50 — Introduction to Databases with SQL
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.

SQLite — SELECT reference
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.

SQLite — CREATE TABLE reference
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.

No sign-in needed.