Measure carrier first-attempt delivery success
Original fictional practice · CC BY 4.0 · 2026-11-11

TASK
Pick the first attempt per package by minute,id. Per carrier return packages_attempted,first_successes. Packages without an attempt are excluded from this attempt metric. Sort carrier.

OUTPUT
carrier, packages_attempted, first_successes

RULES
Pick the first attempt per package by minute,id. Per carrier return packages_attempted,first_successes. Packages without an attempt are excluded from this attempt metric. Sort carrier.
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.

FIELD DICTIONARY
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.

METHOD
Pick the first attempt per package by minute,id. Per carrier return packages_attempted,first_successes. Packages without an attempt are excluded from this attempt metric. Sort carrier.
For the first output record, carrier = X; packages_attempted = 3; first_successes = 3.
Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.

COMMON WRONG TURN
Counting any eventual success as first-attempt success conceals redelivery work.

RESULT CHECK
For the first output record, carrier = X; packages_attempted = 3; first_successes = 3.

Use setup.sql in a fresh SQLite database and run your own SELECT or WITH. reference.sql and expected.csv contain the full worked answer. All CSVs have UTF-8 headers; empty output fields represent NULL. The browser executes SQLite, not Excel formulas. No spreadsheet function engine is claimed.
