Statistical reporting contracts · Original fictional data · Free files and full answers
Flag values exceeding twice their team mean
Compute each team mean over known values, then return team,id,value for observations strictly greater than twice that mean. Sort team,id.
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
- Compute each team mean over known values, then return team,id,value for observations strictly greater than twice that mean. Sort team,id.
- 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, id, value. Sort order follows the task. Output has 3 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
- Compute each team mean over known values, then return team,id,value for observations strictly greater than twice that mean. Sort team,id.
- 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
A global mean erases each team’s different operating scale.
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
WITH x AS (SELECT *,AVG(value) OVER(PARTITION BY team) mean FROM observations) SELECT team,id,value FROM x WHERE value>2*mean ORDER BY team,id;
"team","id","value" "A","5","100" "B","12","55" "C","15","30"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects