[
 {
  "id": "BM01",
  "dataset": "banking",
  "text": "Which CAD account had the highest net card spend during July 2026? Return that account_id, its net card spend in minor units, and how many active cards it has at the snapshot.",
  "columns": [
   "account_id",
   "net_spend_minor",
   "active_cards"
  ],
  "decimals": {},
  "steps": [
   "Net CAD card spend per account for July 2026 (posted purchases minus posted refunds).",
   "Active cards of the top account."
  ],
  "gold_sql": "WITH net AS (SELECT account_id, SUM(net_spend_minor) AS n FROM card_spend_daily WHERE currency='CAD' AND spend_date >= DATE '2026-07-01' AND spend_date < DATE '2026-08-01' GROUP BY account_id), top AS (SELECT account_id, n FROM net ORDER BY n DESC LIMIT 1) SELECT top.account_id, top.n, (SELECT COUNT(*) FROM cards c WHERE c.account_id = top.account_id AND c.card_status = 'active') FROM top",
  "gold_rows": [
   [
    "acct_007",
    130636,
    2
   ]
  ]
 },
 {
  "id": "BM02",
  "dataset": "banking",
  "text": "Which category had the highest gross USD card spend during July 2026? Return the category label, that gross spend in minor units, and the number of USD purchase events behind it.",
  "columns": [
   "category_name",
   "gross_minor",
   "purchase_count"
  ],
  "decimals": {},
  "steps": [
   "Gross USD card spend per category label, keeping the uncategorized bucket.",
   "Purchase count of the top category."
  ],
  "gold_sql": "WITH g AS (SELECT COALESCE(c.category_name, 'Uncategorized') AS label, SUM(s.purchased_minor) AS gross, SUM(s.purchase_count) AS cnt FROM card_spend_daily s LEFT JOIN categories c ON s.category_id = c.category_id WHERE s.currency='USD' AND s.spend_date >= DATE '2026-07-01' AND s.spend_date < DATE '2026-08-01' GROUP BY 1) SELECT label, gross, cnt FROM g ORDER BY gross DESC LIMIT 1",
  "gold_rows": [
   [
    "Uncategorized",
    136827,
    31
   ]
  ]
 },
 {
  "id": "BM03",
  "dataset": "banking",
  "text": "On which day of July 2026 was gross CAD card spend highest? For that day, return the date, the category with the highest gross CAD card spend that day, and that category's gross CAD card spend in minor units.",
  "columns": [
   "spend_date",
   "category_name",
   "gross_minor"
  ],
  "decimals": {},
  "steps": [
   "Gross CAD card spend per posted date.",
   "Gross CAD card spend per category label on the top date."
  ],
  "gold_sql": "WITH d AS (SELECT spend_date FROM card_spend_daily WHERE currency='CAD' AND spend_date >= DATE '2026-07-01' AND spend_date < DATE '2026-08-01' GROUP BY spend_date ORDER BY SUM(purchased_minor) DESC LIMIT 1), c AS (SELECT s.spend_date, COALESCE(k.category_name, 'Uncategorized') AS label, SUM(s.purchased_minor) AS gross FROM card_spend_daily s LEFT JOIN categories k ON s.category_id = k.category_id WHERE s.currency='CAD' AND s.spend_date = (SELECT spend_date FROM d) GROUP BY 1, 2) SELECT spend_date, label, gross FROM c ORDER BY gross DESC LIMIT 1",
  "gold_rows": [
   [
    "2026-07-01",
    "Software",
    20774
   ]
  ]
 },
 {
  "id": "BM04",
  "dataset": "banking",
  "text": "Which account had the largest single refund during July 2026? Return that account_id, its currency, and the account's total refunded amount during July 2026 in minor units.",
  "columns": [
   "account_id",
   "currency",
   "refunded_minor"
  ],
  "decimals": {},
  "steps": [
   "The largest posted refund event in July 2026.",
   "Total posted refunds of that account in July 2026."
  ],
  "gold_sql": "WITH r AS (SELECT account_id FROM transactions WHERE event_kind='refund' AND status='posted' AND posted_at >= TIMESTAMP '2026-07-01' AND posted_at < TIMESTAMP '2026-08-01' ORDER BY amount_minor DESC LIMIT 1) SELECT a.account_id, a.currency, (SELECT SUM(t.amount_minor) FROM transactions t WHERE t.account_id = a.account_id AND t.event_kind='refund' AND t.status='posted' AND t.posted_at >= TIMESTAMP '2026-07-01' AND t.posted_at < TIMESTAMP '2026-08-01') FROM accounts a WHERE a.account_id = (SELECT account_id FROM r)",
  "gold_rows": [
   [
    "acct_007",
    "CAD",
    9626
   ]
  ]
 },
 {
  "id": "BM05",
  "dataset": "banking",
  "text": "Which USD account had the highest closing ledger balance on 2026-07-31? Return that account_id, the closing balance in minor units, and its total deposits during July 2026 in minor units.",
  "columns": [
   "account_id",
   "closing_minor",
   "deposits_minor"
  ],
  "decimals": {},
  "steps": [
   "Closing ledger balance of each USD account on 2026-07-31.",
   "Posted deposits of the top account in July 2026."
  ],
  "gold_sql": "WITH b AS (SELECT account_id, closing_minor FROM account_daily WHERE currency='USD' AND balance_date = DATE '2026-07-31' ORDER BY closing_minor DESC LIMIT 1) SELECT b.account_id, b.closing_minor, (SELECT COALESCE(SUM(t.amount_minor), 0) FROM transactions t WHERE t.account_id = b.account_id AND t.event_kind='deposit' AND t.status='posted' AND t.posted_at >= TIMESTAMP '2026-07-01' AND t.posted_at < TIMESTAMP '2026-08-01') FROM b",
  "gold_rows": [
   [
    "acct_012",
    23490,
    64844
   ]
  ]
 },
 {
  "id": "BM06",
  "dataset": "banking",
  "text": "Which organization had the highest net CAD card spend during July 2026, summed across its accounts? Return the organization_id, that amount in minor units, the organization's USD account_id, and that USD account's closing ledger balance on 2026-07-31 in minor units.",
  "columns": [
   "organization_id",
   "net_spend_minor",
   "usd_account_id",
   "closing_minor"
  ],
  "decimals": {},
  "steps": [
   "Net CAD card spend per organization for July 2026.",
   "The USD account of the top organization.",
   "Its closing ledger balance on 2026-07-31."
  ],
  "gold_sql": "WITH o AS (SELECT a.organization_id, SUM(s.net_spend_minor) AS n FROM card_spend_daily s JOIN accounts a ON s.account_id = a.account_id WHERE s.currency='CAD' AND s.spend_date >= DATE '2026-07-01' AND s.spend_date < DATE '2026-08-01' GROUP BY 1 ORDER BY n DESC LIMIT 1) SELECT o.organization_id, o.n, a.account_id, d.closing_minor FROM o JOIN accounts a ON a.organization_id = o.organization_id AND a.currency = 'USD' JOIN account_daily d ON d.account_id = a.account_id AND d.balance_date = DATE '2026-07-31'",
  "gold_rows": [
   [
    "org_03",
    253869,
    "acct_009",
    18566
   ]
  ]
 },
 {
  "id": "BM07",
  "dataset": "banking",
  "text": "What was the largest single internal transfer during July 2026? Return the sending account_id, the receiving account_id and the amount in minor units.",
  "columns": [
   "from_account_id",
   "to_account_id",
   "amount_minor"
  ],
  "decimals": {},
  "steps": [
   "The largest posted transfer debit leg in July 2026.",
   "The credit leg with the same transfer_group_id."
  ],
  "gold_sql": "WITH d AS (SELECT transfer_group_id, account_id, amount_minor FROM transactions WHERE event_kind='transfer' AND direction='debit' AND status='posted' AND posted_at >= TIMESTAMP '2026-07-01' AND posted_at < TIMESTAMP '2026-08-01' ORDER BY amount_minor DESC LIMIT 1) SELECT d.account_id, c.account_id, d.amount_minor FROM d JOIN transactions c ON c.transfer_group_id = d.transfer_group_id AND c.direction = 'credit'",
  "gold_rows": [
   [
    "acct_009",
    "acct_012",
    4124
   ]
  ]
 },
 {
  "id": "BM08",
  "dataset": "banking",
  "text": "Which account has the most pending transactions at the snapshot? Return that account_id, the number of its pending transactions, their total amount in minor units, and the account's opening ledger balance on 2026-07-01 in minor units.",
  "columns": [
   "account_id",
   "pending_count",
   "pending_minor",
   "opening_minor"
  ],
  "decimals": {},
  "steps": [
   "Pending transactions per account.",
   "Opening ledger balance of the top account on 2026-07-01."
  ],
  "gold_sql": "WITH p AS (SELECT account_id, COUNT(*) AS n, SUM(amount_minor) AS m FROM transactions WHERE status='pending' GROUP BY account_id ORDER BY n DESC LIMIT 1) SELECT p.account_id, p.n, p.m, a.opening_balance_minor FROM p JOIN accounts a ON a.account_id = p.account_id",
  "gold_rows": [
   [
    "acct_002",
    4,
    6370,
    42614
   ]
  ]
 },
 {
  "id": "CM01",
  "dataset": "chicago",
  "text": "Which pickup area had the most recorded trips in the sample? For that area, return its name, the trip date with the most pickups there, and that date's number of trips picked up there.",
  "columns": [
   "area",
   "trip_date",
   "trips"
  ],
  "decimals": {},
  "steps": [
   "Trips per pickup area.",
   "Trips per date for the top area."
  ],
  "gold_sql": "WITH a AS (SELECT t.pickup_zone_id FROM trips t GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 1) SELECT z.zone_name, t.trip_date, COUNT(*) AS n FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE t.pickup_zone_id = (SELECT pickup_zone_id FROM a) GROUP BY 1, 2 ORDER BY n DESC LIMIT 1",
  "gold_rows": [
   [
    "Near North Side",
    "2024-01-27",
    78
   ]
  ]
 },
 {
  "id": "CM02",
  "dataset": "chicago",
  "text": "Which trip date had the highest total published fare? On that date, which pickup area had the most trips? Return the date, the area name and that area's trip count on that date.",
  "columns": [
   "trip_date",
   "area",
   "trips"
  ],
  "decimals": {},
  "steps": [
   "Total published fare per date.",
   "Trips per pickup area on the top date."
  ],
  "gold_sql": "WITH d AS (SELECT trip_date FROM trips GROUP BY 1 ORDER BY SUM(fare) DESC LIMIT 1) SELECT t.trip_date, z.zone_name, COUNT(*) AS n FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE t.trip_date = (SELECT trip_date FROM d) GROUP BY 1, 2 ORDER BY n DESC LIMIT 1",
  "gold_rows": [
   [
    "2024-01-27",
    "Near North Side",
    78
   ]
  ]
 },
 {
  "id": "CM03",
  "dataset": "chicago",
  "text": "Among pickup areas with at least 100 recorded trips, excluding 'Outside Chicago or unavailable', which has the highest mean published fare (excluding missing fares)? Return the area name, its trip count, its mean fare and its mean trip miles, each mean rounded to 2 decimals.",
  "columns": [
   "area",
   "trips",
   "mean_fare",
   "mean_miles"
  ],
  "decimals": {
   "mean_fare": 2,
   "mean_miles": 2
  },
  "steps": [
   "Trip count and mean fare per pickup area.",
   "Mean trip miles for the qualifying area with the highest mean fare."
  ],
  "gold_sql": "SELECT z.zone_name, COUNT(*) AS n, ROUND(AVG(t.fare), 2), ROUND(AVG(t.trip_miles), 2) FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE z.zone_id <> 0 GROUP BY 1 HAVING COUNT(*) >= 100 ORDER BY AVG(t.fare) DESC LIMIT 1",
  "gold_rows": [
   [
    "Ohare",
    396,
    37.0,
    20.02
   ]
  ]
 },
 {
  "id": "CM04",
  "dataset": "chicago",
  "text": "Which dropoff area received the most trips that were actually matched for sharing? For trips picked up in that same area, return the area name, the number of trips and how many of them were actually matched for sharing.",
  "columns": [
   "area",
   "trips",
   "matched"
  ],
  "decimals": {},
  "steps": [
   "Matched trips per dropoff area.",
   "Trips and matched trips picked up in the top area."
  ],
  "gold_sql": "WITH d AS (SELECT dropoff_zone_id FROM trips WHERE shared_trip_match GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 1) SELECT z.zone_name, COUNT(*), SUM(CASE WHEN t.shared_trip_match THEN 1 ELSE 0 END) FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE t.pickup_zone_id = (SELECT dropoff_zone_id FROM d) GROUP BY 1",
  "gold_rows": [
   [
    "Near West Side",
    816,
    28
   ]
  ]
 },
 {
  "id": "CM05",
  "dataset": "chicago",
  "text": "Which trip date had the fewest recorded trips? Return that date, its trip count, and how many fewer trips it had than the busiest date.",
  "columns": [
   "trip_date",
   "trips",
   "fewer_than_busiest"
  ],
  "decimals": {},
  "steps": [
   "Trips per date.",
   "The busiest date's count, for the difference."
  ],
  "gold_sql": "WITH d AS (SELECT trip_date, COUNT(*) AS n FROM trips GROUP BY 1) SELECT trip_date, n, (SELECT MAX(n) FROM d) - n FROM d ORDER BY n ASC LIMIT 1",
  "gold_rows": [
   [
    "2024-01-02",
    212,
    232
   ]
  ]
 },
 {
  "id": "CM06",
  "dataset": "chicago",
  "text": "Among the three pickup areas with the most recorded trips, which has the lowest mean trip miles? Return the area name and its mean trip miles rounded to 2 decimals.",
  "columns": [
   "area",
   "mean_miles"
  ],
  "decimals": {
   "mean_miles": 2
  },
  "steps": [
   "Trips per pickup area, top three.",
   "Mean trip miles of those three."
  ],
  "gold_sql": "WITH a AS (SELECT pickup_zone_id FROM trips GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 3) SELECT z.zone_name, ROUND(AVG(t.trip_miles), 2) FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE t.pickup_zone_id IN (SELECT pickup_zone_id FROM a) GROUP BY 1 ORDER BY AVG(t.trip_miles) ASC LIMIT 1",
  "gold_rows": [
   [
    "Near North Side",
    4.39
   ]
  ]
 },
 {
  "id": "CM07",
  "dataset": "chicago",
  "text": "Excluding 'Outside Chicago or unavailable', which pickup area had the most trips authorized for sharing? For that area, on which trip date did it have the most trips authorized for sharing? Return the area name, the date and that date's authorized trip count.",
  "columns": [
   "area",
   "trip_date",
   "authorized_trips"
  ],
  "decimals": {},
  "steps": [
   "Authorized trips per pickup area.",
   "Authorized trips per date for the top area."
  ],
  "gold_sql": "WITH a AS (SELECT pickup_zone_id FROM trips WHERE shared_trip_authorized AND pickup_zone_id <> 0 GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 1) SELECT z.zone_name, t.trip_date, COUNT(*) AS n FROM trips t JOIN zones z ON t.pickup_zone_id = z.zone_id WHERE t.shared_trip_authorized AND t.pickup_zone_id = (SELECT pickup_zone_id FROM a) GROUP BY 1, 2 ORDER BY n DESC LIMIT 1",
  "gold_rows": [
   [
    "Near North Side",
    "2024-01-17",
    7
   ]
  ]
 },
 {
  "id": "CM08",
  "dataset": "chicago",
  "text": "On the trip date with the most recorded trips, what percentage of that date's trips were picked up in the pickup area with the most trips over the whole sample? Return the date, the area name and the percentage rounded to 2 decimals.",
  "columns": [
   "trip_date",
   "area",
   "percent"
  ],
  "decimals": {
   "percent": 2
  },
  "steps": [
   "The busiest date.",
   "The busiest pickup area over the sample.",
   "That area's trips on that date as a share of the date's trips."
  ],
  "gold_sql": "WITH d AS (SELECT trip_date FROM trips GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 1), a AS (SELECT pickup_zone_id FROM trips GROUP BY 1 ORDER BY COUNT(*) DESC LIMIT 1) SELECT t.trip_date, z.zone_name, ROUND(100.0 * SUM(CASE WHEN t.pickup_zone_id = (SELECT pickup_zone_id FROM a) THEN 1 ELSE 0 END) / COUNT(*), 2) FROM trips t JOIN zones z ON z.zone_id = (SELECT pickup_zone_id FROM a) WHERE t.trip_date = (SELECT trip_date FROM d) GROUP BY 1, 2",
  "gold_rows": [
   [
    "2024-01-20",
    "Near North Side",
    16.44
   ]
  ]
 }
]
