Statistical reporting contracts · Original fictional data · Free files and full answers
Track cumulative data completeness
For each team/day return cumulative known_count and observed_rows through that row, sorted team,day. A known zero counts as known; NULL does not.
Use this fixed business case to build a checked CSV and a replayable SQL handoff. No account required. Scenario datasets are shared across related exercises; each exercise has its own decision and output contract.
Your output contract
- For each team/day return cumulative known_count and observed_rows through that row, sorted team,day. A known zero counts as known; NULL does not.
- Return exactly the declared columns and order. Money uses integer cents; all time values are elapsed UTC minutes unless a field is explicitly a day index. NULL is unknown and differs from numeric zero.
- These are original fictional records and exercise policies. All source tables in this case are included in the downloadable pack.
Return columns exactly as team, day, known_count, observed_rows. Sort order follows the task. Output has 16 rows; an empty CSV field means NULL.
Source data
observations
16 source rows · Download observations CSV
| id INTEGER | team TEXT | day INTEGER | value INTEGER | weight INTEGER |
|---|---|---|---|---|
| 1 | A | 1 | 10 | 1 |
| 2 | A | 2 | 20 | 2 |
| 3 | A | 3 | NULL | 1 |
| 4 | A | 4 | 40 | 1 |
| 5 | A | 5 | 100 | 1 |
| 6 | A | 6 | 20 | 3 |
| 7 | B | 1 | 5 | 2 |
| 8 | B | 2 | 5 | 1 |
| 9 | B | 3 | 15 | 1 |
| 10 | B | 4 | 25 | 2 |
| 11 | B | 5 | 35 | 1 |
| 12 | B | 6 | 55 | 1 |
| 13 | C | 1 | 0 | 1 |
| 14 | C | 2 | 10 | 1 |
| 15 | C | 3 | 30 | 2 |
| 16 | C | 4 | 10 | 1 |
Field dictionary and schema
observations: id INTEGER — Stable record or business key; retain its declared type. team TEXT — Literal text label or key; comparisons use SQLite binary text semantics. day INTEGER — Exact integer measurement; use the task rule for units and ordering. value INTEGER — Exact integer measurement; use the task rule for units and ordering. weight INTEGER — Exact integer measurement; use the task rule for units and ordering.
A method you can reuse
- For each team/day return cumulative known_count and observed_rows through that row, sorted team,day. A known zero counts as known; NULL does not.
- Inspect the source grain, keys and ties before writing the query. Use the worked SQL and complete expected CSV to review any mismatch.
Watch for this wrong turn
COUNT(*) reports observed rows, not completeness of the measured value.
Run and check in SQLite
Your SQL runs locally in the existing SQLite worker. The checker compares every column, row, type, value and row order with this fixed output. It accepts equivalent SELECT or WITH queries. Browser storage keeps your SQL on this device when available.
Complete worked SQL and expected output
SELECT team,day,COUNT(value) OVER(PARTITION BY team ORDER BY day ROWS UNBOUNDED PRECEDING) known_count,COUNT(*) OVER(PARTITION BY team ORDER BY day ROWS UNBOUNDED PRECEDING) observed_rows FROM observations ORDER BY team,day;
"team","day","known_count","observed_rows" "A","1","1","1" "A","2","2","2" "A","3","2","3" "A","4","3","4" "A","5","4","5" "A","6","5","6" "B","1","1","1" "B","2","2","2" "B","3","3","3" "B","4","4","4" "B","5","5","5" "B","6","6","6" "C","1","1","1" "C","2","2","2" "C","3","3","3" "C","4","4","4"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects