Assign one primary ingest rejection reason per row Original fictional practice · CC BY 4.0 · 2026-11-11 TASK Priority: deleted→tombstone; qty<0→negative_qty; bad total→bad_total; invalid country/currency→bad_pair; otherwise accepted. Return reason,row_count with reasons actually present, sorted reason. OUTPUT reason, row_count RULES Priority: deleted→tombstone; qty<0→negative_qty; bad total→bad_total; invalid country/currency→bad_pair; otherwise accepted. Return reason,row_count with reasons actually present, sorted reason. 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 records: id INTEGER — Stable source record identifier; not a row position. batch TEXT — Literal business key or category label. Match exactly and retain NULL where present. customer TEXT — Literal business key or category label. Match exactly and retain NULL where present. email TEXT — Literal business key or category label. Match exactly and retain NULL where present. country TEXT — Literal business key or category label. Match exactly and retain NULL where present. currency TEXT — Literal business key or category label. Match exactly and retain NULL where present. qty INTEGER — Physical quantity; multiply through assembly paths when the task requires it. unit_price INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. total INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task. deleted INTEGER — Tombstone flag:1 deleted,0 active; apply precedence before filtering. country_currency: country TEXT — Literal business key or category label. Match exactly and retain NULL where present. currency TEXT — Literal business key or category label. Match exactly and retain NULL where present. attributes: record_id INTEGER — Foreign business-record identifier; match to the named source key. name TEXT — Literal business key or category label. Match exactly and retain NULL where present. value TEXT — Measured numeric value; NULL means unobserved. METHOD Priority: deleted→tombstone; qty<0→negative_qty; bad total→bad_total; invalid country/currency→bad_pair; otherwise accepted. Return reason,row_count with reasons actually present, sorted reason. For the first output record, reason = accepted; row_count = 6. Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV. COMMON WRONG TURN Summing independent rule failures can exceed the source count because one row can fail several rules. RESULT CHECK For the first output record, reason = accepted; row_count = 6. 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.