For teachers · class guide
← Caso Abierto for the classroom
A 50-minute plan with three levels. No solutions: no culprits, no answer values.
Introduction · T1·01
SELECT WHERE date ranges ORDER BY
Narrowing a time window looks easy with BETWEEN, but BETWEEN includes both ends, and with dates and times that is rarely what you want. With >= and < you control exactly which edge is in. See this trap's page →
The final query that narrows the case's time window and answers the three questions in the case file, plus one sentence explaining what changed from their first attempt.
Intermediate · T2·03
anti-join NOT EXISTS LEFT JOIN … IS NULL the NOT IN with NULL trap
A NOT IN against a list containing a single NULL throws out the whole query without a warning: it doesn't fail, it just returns nothing, and that gives false confidence. See this trap's page →
The query that finds the one execution with no ledger entry, plus one sentence explaining why their first NOT IN attempt returned zero rows (or all of them) instead of the missing one.
Advanced · T3·01
cardinality fan-out aggregate before joining COUNT DISTINCT
Aggregating after a one-to-many JOIN duplicates every row on the "one" side once per matching row on the other side, and any SUM computed afterward comes out inflated. See this trap's page →
The query that calculates the quarter's real commission without the duplication, plus one sentence explaining how they detected the original report was inflated.
Solutions for the teacher are sent separately, to whoever requests the license.
The first case runs free in your browser, no signup.
Play the first case free →