Business calendars and period reporting · Original fictional data · Free files and full answers
Fill absent activity dates without replacing real zeros
For every supplied calendar day return day,revenue_cents,source_rows. No activity has sum0 and source_rows0; an actual zero event has source_rows1. Sort day.
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 every supplied calendar day return day,revenue_cents,source_rows. No activity has sum0 and source_rows0; an actual zero event has source_rows1. Sort day.
- Return exactly the declared columns and order. Money uses integer cents; time and date units follow the task and field dictionary. NULL is unknown and differs from numeric zero.
- These are original fictional records and exercise policies. Scenario data may be shared with related tasks, whose decisions and output contracts differ.
Return columns exactly as day, revenue_cents, source_rows. Sort order follows the task. Output has 15 rows; an empty CSV field means NULL.
Source data
calendar
15 source rows · Download calendar CSV
| day TEXT | holiday INTEGER |
|---|---|
| 2026-11-01 | 0 |
| 2026-11-02 | 0 |
| 2026-11-03 | 1 |
| 2026-11-04 | 0 |
| 2026-11-05 | 0 |
| 2026-11-06 | 0 |
| 2026-11-07 | 0 |
| 2026-11-08 | 0 |
| 2026-11-09 | 0 |
| 2026-11-10 | 0 |
| 2026-11-11 | 1 |
| 2026-11-12 | 0 |
| 2026-11-13 | 0 |
| 2026-11-14 | 0 |
| 2026-11-15 | 0 |
daily
6 source rows · Download daily CSV
| day TEXT | cents INTEGER |
|---|---|
| 2026-11-01 | 100 |
| 2026-11-03 | 200 |
| 2026-11-03 | 50 |
| 2026-11-07 | 0 |
| 2026-11-11 | 300 |
| 2026-11-15 | 400 |
cases
4 source rows · Download cases CSV
| id INTEGER | opened TEXT | birthday TEXT |
|---|---|---|
| 1 | 2026-11-01 | 2000-02-29 |
| 2 | 2026-11-03 | 1990-06-10 |
| 3 | 2026-11-06 | 1984-02-29 |
| 4 | 2026-11-13 | 1995-12-01 |
fiscal_dates
6 source rows · Download fiscal_dates CSV
| day TEXT |
|---|
| 2026-03-31 |
| 2026-04-01 |
| 2026-12-31 |
| 2027-01-01 |
| 2027-03-31 |
| 2027-04-01 |
Field dictionary and schema
calendar: day TEXT — Integer day index, or ISO YYYY-MM-DD date when stored as text; the task declares cutoff semantics. holiday INTEGER — 1 means an explicitly closed holiday,0 otherwise. daily: day TEXT — Integer day index, or ISO YYYY-MM-DD date when stored as text; the task declares cutoff semantics. cents INTEGER — Signed integer currency cents. cases: id INTEGER — Stable source record identifier; not a row position. opened TEXT — ISO case opening date. birthday TEXT — ISO date used to demonstrate the stated anniversary policy. fiscal_dates: day TEXT — Integer day index, or ISO YYYY-MM-DD date when stored as text; the task declares cutoff semantics.
A method you can reuse
- For every supplied calendar day return day,revenue_cents,source_rows. No activity has sum0 and source_rows0; an actual zero event has source_rows1. Sort day.
- For the first output record, day = 2026-11-01; revenue_cents = 100; source_rows = 1.
- Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.
Watch for this wrong turn
Replacing missing dates with zero but omitting source counts makes a measured zero indistinguishable from no event.
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 c.day,COALESCE(SUM(d.cents),0) revenue_cents,COUNT(d.day) source_rows FROM calendar c LEFT JOIN daily d ON d.day=c.day GROUP BY c.day ORDER BY c.day;
"day","revenue_cents","source_rows" "2026-11-01","100","1" "2026-11-02","0","0" "2026-11-03","250","2" "2026-11-04","0","0" "2026-11-05","0","0" "2026-11-06","0","0" "2026-11-07","0","1" "2026-11-08","0","0" "2026-11-09","0","0" "2026-11-10","0","0" "2026-11-11","300","1" "2026-11-12","0","0" "2026-11-13","0","0" "2026-11-14","0","0" "2026-11-15","400","1"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects