Identify unexpected attributes and missing mandatory fields
Original fictional practice · CC BY 4.0 · 2026-11-11

TASK
Allowed attributes are color,size. Return record_id,issue for unexpected attribute names, plus missing_color for each record appearing in attributes without a color row. UNION both issue types; sort record_id,issue.

OUTPUT
record_id, issue

RULES
Allowed attributes are color,size. Return record_id,issue for unexpected attribute names, plus missing_color for each record appearing in attributes without a color row. UNION both issue types; sort record_id,issue.
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
Allowed attributes are color,size. Return record_id,issue for unexpected attribute names, plus missing_color for each record appearing in attributes without a color row. UNION both issue types; sort record_id,issue.
For the first output record, record_id = 4; issue = missing_color.
Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.

COMMON WRONG TURN
Checking only for unexpected names does not detect a missing required attribute.

RESULT CHECK
For the first output record, record_id = 4; issue = missing_color.

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.
