Delivery evidence and route operations · Original fictional data · Free files and full answers
Separate travel time from stop dwell
For each route/stop return route,seq,dwell_minutes,travel_from_previous. The first travel isNULL; later travel is arrival minus previous departure. Sort route,seq.
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 route/stop return route,seq,dwell_minutes,travel_from_previous. The first travel isNULL; later travel is arrival minus previous departure. Sort route,seq.
- 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 route, seq, dwell_minutes, travel_from_previous. Sort order follows the task. Output has 6 rows; an empty CSV field means NULL.
Source data
packages
7 source rows · Download packages CSV
| id INTEGER | order_id INTEGER | planned_day INTEGER | delivered_day INTEGER | units INTEGER | required_units INTEGER | carrier TEXT |
|---|---|---|---|---|---|---|
| 1 | 1 | 3 | 2 | 2 | 5 | X |
| 2 | 1 | 3 | 4 | 3 | 5 | Y |
| 3 | 2 | 4 | 4 | 4 | 4 | X |
| 4 | 3 | 5 | NULL | 1 | 3 | Y |
| 5 | 3 | 5 | 5 | 2 | 3 | Y |
| 6 | 4 | 6 | 5 | 2 | 2 | X |
| 7 | 5 | 6 | 7 | 1 | 2 | Y |
attempts
10 source rows · Download attempts CSV
| id INTEGER | package_id INTEGER | minute INTEGER | result TEXT |
|---|---|---|---|
| 1 | 1 | 100 | success |
| 2 | 2 | 120 | failed |
| 3 | 2 | 200 | success |
| 4 | 3 | 80 | success |
| 5 | 4 | 150 | failed |
| 6 | 4 | 240 | failed |
| 7 | 5 | 160 | success |
| 8 | 6 | 200 | success |
| 9 | 7 | 300 | failed |
| 10 | 7 | 500 | success |
stops
6 source rows · Download stops CSV
| route TEXT | seq INTEGER | arrive INTEGER | depart INTEGER | load_delta INTEGER | kind TEXT | pair_id TEXT |
|---|---|---|---|---|---|---|
| R | 1 | 0 | 10 | 5 | pickup | A |
| R | 2 | 30 | 40 | 4 | pickup | B |
| R | 3 | 60 | 75 | -5 | drop | A |
| R | 4 | 90 | 95 | -4 | drop | B |
| S | 1 | 0 | 5 | -2 | drop | C |
| S | 2 | 20 | 30 | 2 | pickup | C |
proofs
5 source rows · Download proofs CSV
| package_id INTEGER | kind TEXT |
|---|---|
| 1 | signature |
| 2 | photo |
| 3 | signature |
| 5 | scan |
| 6 | signature |
Field dictionary and schema
packages: id INTEGER — Stable source record identifier; not a row position. order_id INTEGER — Foreign business-record identifier; match to the named source key. planned_day INTEGER — Day index or ISO date as declared in this task; preserve its source representation. delivered_day INTEGER — Day index or ISO date as declared in this task; preserve its source representation. units INTEGER — Physical unit quantity, not a monetary amount. required_units INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. carrier TEXT — Literal business key or category label. Match exactly and retain NULL where present. attempts: id INTEGER — Stable source record identifier; not a row position. package_id INTEGER — Foreign business-record identifier; match to the named source key. minute INTEGER — Elapsed UTC minute from the fictional scenario origin. result TEXT — Literal business key or category label. Match exactly and retain NULL where present. stops: route TEXT — Literal business key or category label. Match exactly and retain NULL where present. seq INTEGER — Declared event or route sequence, ascending within its owner. arrive INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. depart INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. load_delta INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. kind TEXT — Literal business key or category label. Match exactly and retain NULL where present. pair_id TEXT — Foreign business-record identifier; match to the named source key. proofs: package_id INTEGER — Foreign business-record identifier; match to the named source key. kind TEXT — Literal business key or category label. Match exactly and retain NULL where present.
A method you can reuse
- For each route/stop return route,seq,dwell_minutes,travel_from_previous. The first travel isNULL; later travel is arrival minus previous departure. Sort route,seq.
- For the first output record, route = R; seq = 1; dwell_minutes = 10; travel_from_previous = NULL.
- Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.
Watch for this wrong turn
Arrival-to-arrival time mixes unloading dwell with road travel.
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 route,seq,depart-arrive dwell_minutes,arrive-LAG(depart) OVER(PARTITION BY route ORDER BY seq) travel_from_previous FROM stops ORDER BY route,seq;
"route","seq","dwell_minutes","travel_from_previous" "R","1","10", "R","2","10","20" "R","3","15","20" "R","4","5","15" "S","1","5", "S","2","10","15"Reference SQL · Complete expected CSV · Empty answer CSV
Choose another SQL task · Original data exception cases · Larger workplace projects