Compute duplicate-preserving excess rows between two feeds
Original fictional practice · CC BY 4.0 · 2026-11-11

TASK
Compare feed one against two by key multiplicity. Return key,excess_copies=max(0,count_one-count_two), positive only, sorted key.

OUTPUT
key, excess_copies

RULES
Compare feed one against two by key multiplicity. Return key,excess_copies=max(0,count_one-count_two), positive only, sorted key.
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
features:
  entity TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  feature TEXT — Literal business key or category label. Match exactly and retain NULL where present.

feeds:
  feed TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  key TEXT — Literal business key or category label. Match exactly and retain NULL where present.

evidence:
  claim TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  source TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  owner TEXT — Literal business key or category label. Match exactly and retain NULL where present.

METHOD
Compare feed one against two by key multiplicity. Return key,excess_copies=max(0,count_one-count_two), positive only, sorted key.
For the first output record, key = a; excess_copies = 1.
Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.

COMMON WRONG TURN
EXCEPT removes duplicates and cannot report an extra copy of a key present in both feeds.

RESULT CHECK
For the first output record, key = a; excess_copies = 1.

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.
