Applied edition · 44 planned hours · Unpiloted · Human review pending. Self-review is not a credential; the full 108-hour semester remains unfinished. No browser SQL execution.
Explained key — Units 1–4
Attempt first. Equivalent SQL earns the same self-review result if its population, grain, missingness and output contract are correct. A memorized number without reasoning is incomplete. The model queries are in queries/; verified expected tables are in expected-results.json and expected-tables.md.
G1 / I1 / C1: identity before arithmetic
G1: sessions describe sessions; registrations describe bookings. Primary keys are session_id and reg_id. registrations.session_id is a many-to-one foreign key. booking_ref can repeat and represents a booking contact reference, not every participant. Base controls are 10 booking rows, 8 references, 14 seats (u01_inventory). None measures actual unique attendees. A question such as “What fraction of listed open-session capacity is booked?” is answerable; “How many different people benefited?” is not.
I1: independent has 5 bookings, 4 references, 7 seats. Session 203 has two bookings but one capacity fact (4). If a flat export changed one capacity to 5 and left the other at 4, it would contain conflicting statements about the same session. Store capacity at session grain; do not choose whichever duplicate supports your preferred result. starts_on happens to be unique here, but the contract permits multiple sessions on one day, so sample uniqueness is not proof of a candidate key.
C1: ten rows means ten booking records, not ten people or ten attendances. Repeated session IDs in bookings are expected foreign-key repetition; a repeated primary session key in sessions would violate the chosen identity constraint. A sound answer explains both repetitions rather than calling every repeated number a duplicate.
Self-review U1: complete requires the question/population, both grains, both primary keys, relationship, all three controls and the unsupported-reach caveat. Partial if arithmetic is right but entity meanings are unclear; not yet if you equate records with people or sum repeated capacity as new capacity.
G2 / I2 / C2: boundary and order
G2: u02_open_sessions returns 101,102,103,105,106 in date/ID order. u02_large_bookings returns 1001,1004,1005,1007, all two-seat bookings. u02_date_window returns 101,102,103; the exclusive end is September 11. u02_fee_display sorts 1200-cent bookings 1001,1004,1005,1007, then 600-cent bookings 1002,1003,1008,1009,1010, then zero-fee 1006. CAD display values are 12,6,0 respectively. >=2 retains the boundary; >2 selects none. 250/100 is integer 2; 250/100.0 is real 2.5.
I2: open session IDs 201,202,203; two-seat bookings 2003,2004. Fee sort order is 2003,2004,2001,2002,2005, displaying 5,5,2.5,2.5,0 CAD. An October 2–9 inclusive window uses starts_on>='2026-10-02' AND starts_on<'2026-10-10': includes 201 at the start and 203 on the final included date, excludes 204 at the end boundary. The supplied September query intentionally returns no independent rows; change the dates in your own file rather than pretending the fixture changed.
An imagined North cancelled session exposes site='North' OR site='South' AND status='open': the North branch alone is true. Parenthesizing the site alternatives makes open status apply to both. Omitting reg_id after fee leaves equal-fee rows tied, so their relative order is unspecified.
C2: unique-key tie-breakers make repeated outputs comparable. Integer division can discard the fractional unit; force real division for a display amount, while preserving integer cents as the source/control unit.
Self-review U2: complete requires correct selected IDs, boundary logic, complete order and a units explanation. Partial if values match but equal-fee ties are unspecified; not yet if the date end or cents conversion changes the intended population/value.
G3 / I3 / C3: missing is not observed zero
G3: missing attendance IDs 1003 and 1007, representing 3 seats. Record coverage is 8/10=80%; seat coverage 11/14≈78.57%. Booking 1002 records zero, 1003 records NULL, session 106 has no booking. u03_quality_counts returns 10,8,2,8: total booking rows, known attendance rows, unknown rows, recorded attended seats. The final 8 is not a proven complete attendance total.
Raw log: ingest 1 and 2 both claim 9001, preserve both pending a deduplication/provenance decision; 3 points to nonexistent 999, quarantine pending authoritative session identification; 4 lacks a registration identity, do not invent one; 5 has zero reserved seats, investigate against the positive-seat rule; 6 records two attended for one booked seat, resolve the inconsistency before admission. u03_duplicate_intake returns (9001,2). u03_invalid_intake returns ingest 4,5,6. The orphan query introduced in Unit 6 returns ingest 3. None enters trusted totals.
I3: duplicate claimed identity 9101 occurs in ingest 11,12. Orphan 13 references 999. Invalid/missing-count query returns 14,15,16. In a future row a duplicate identity could also be an orphan with invalid seats; adding check counts would double-count that row. An identical retransmission may be deduplicated for an admitted view only after the identity/provenance policy is justified; retain the raw event. Conflicting claims need an authoritative correction, not automatic first/last selection.
C3: COALESCE adds no observation. Dividing known attendance by all seats after treating missing as zero implicitly asserts missing bookings had no attendance. It may serve a clearly labelled lower bound, not the measured complete rate. An acceptable owner role is the fictional attendance-record custodian; writing the role is a simulation, not a real message or secured staff assignment.
Self-review U3: complete requires distinct zero/NULL/no-row explanations, all check classes, coverage denominators and cautious handling. Partial if errors are found but silently dropped; not yet if unknown becomes asserted zero or an orphan parent is fabricated.
G4 / I4 / C4: what is being averaged?
G4: grouped rows are (101,3,4,2,2), (102,2,4,2,3), (103,2,3,1,1), (105,3,3,3,2) in the columns shown in Unit 4. Columns sum to 10,14,8,8. Missing session groups are not zero rows. Known-only attendance rows are 101:2/3=66.67%; 102:3/4=75%; 103:1/1=100%; 105:2/3=66.67%. Pooled 8/11=72.73%, while the unweighted mean of unrounded group rates is 77.0833…%. The latter weights a one-seat denominator as heavily as a four-seat denominator. HAVING at least four seats retains 101,102.
I4: grouped rows (201,2,2,1,1), (202,1,2,1,0), (203,2,3,2,3) reconcile to 5 bookings,7 seats,4 known-attendance rows,4 recorded attended seats. Known rates: 201:1/1=100%; 202:0/2=0%; 203:3/3=100%. Overall known-only rate 4/6=66.67%. The unweighted average also happens to be 66.67% here, an accidental agreement rather than proof of the method. Base is the counterexample. All-booking mean size 7/5=1.4; all-listed-session mean booked seats 7/4=1.75; open-session mean 7/3≈2.3333. Counts describe different entities and populations.
C4: scalar empty aggregate is one row (0,NULL,NULL) for count, sum and average; a grouped empty input yields no rows. Zero rows do not create a measured 0% rate. Weight group rates by their denominators or recompute a pooled numerator/denominator, retaining unrounded values until display.
Self-review U4: complete requires source reconciliation, actual denominators, empty behavior and a counterexample to averaging rates. Partial if group results match without explaining missing sessions; not yet if a wrong denominator or bare non-grouped label remains.