Dataset Viewer
Auto-converted to Parquet Duplicate
task_id
stringclasses
10 values
split
stringclasses
1 value
seed
int64
42
42
instruction
stringclasses
10 values
schema
stringclasses
10 values
expected_rows_json
stringclasses
10 values
oracle_sql
stringclasses
10 values
sales_net_revenue
train
42
Find net revenue for each customer segment having at least one completed order. Revenue is SUM(quantity * unit_price_cents) minus posted refunds, considering only completed orders. Pending refunds and cancelled orders do not count. Avoid counting either items or refunds multiple times. Columns: segment, net_revenue_cen...
CREATE TABLE customers(customer_id INTEGER PRIMARY KEY, segment TEXT NOT NULL); CREATE TABLE orders(order_id INTEGER PRIMARY KEY, customer_id INTEGER NOT NULL, status TEXT NOT NULL); CREATE TABLE order_items(item_id INTEGER PRIMARY KEY, order_id INTEGER NOT NULL, quantity INTEGER NOT NULL, unit_price_ce...
[["business", 15281], ["consumer", 32257], ["education", 33346]]
WITH item_totals AS ( SELECT order_id, SUM(quantity * unit_price_cents) AS amount FROM order_items GROUP BY order_id ), refund_totals AS ( SELECT order_id, SUM(amount_cents) AS amount FROM refunds WHERE status = 'posted' GROUP BY order_id ) SELECT c.segment, SUM(i.amount ...
inventory_shortages
train
42
List products whose total available stock across all warehouses is strictly below their reorder_point. Available stock is all inventory units minus active reservation units; missing inventory or reservations mean zero. Negative availability is valid. Cancelled reservations do not count. Columns: product_id, available_u...
CREATE TABLE products(product_id INTEGER PRIMARY KEY, reorder_point INTEGER NOT NULL); CREATE TABLE warehouses(warehouse_id INTEGER PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE inventory(product_id INTEGER NOT NULL, warehouse_id INTEGER NOT NULL, units INTEGER NOT NULL, PRIMARY KEY(product_id, warehou...
[[1, 0], [2, -1], [3, -3], [4, 10], [5, 11], [7, -10], [8, -2]]
WITH stocks AS (SELECT product_id, SUM(units) AS units FROM inventory GROUP BY product_id), held AS (SELECT product_id, SUM(units) AS units FROM reservations WHERE status = 'active' GROUP BY product_id) SELECT p.product_id, COALESCE(s.units, 0) - COALESCE(h.units, 0) AS available_units FROM prod...
service_failure_rates
train
42
Compute the weighted failure rate for each service with at least five valid observed days. A valid day has requests > 0 and non-NULL failures; discard an entire day if either count is missing. The rate is SUM(failures) / SUM(requests) across valid days, not the mean of daily rates. Columns: service_id, failure_rate (ro...
CREATE TABLE services(service_id INTEGER PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE daily_metrics(service_id INTEGER NOT NULL, day TEXT NOT NULL, requests INTEGER, failures INTEGER, PRIMARY KEY(service_id, day)); -- services: 6 rows -- daily_metrics: 60 rows
[[1, 0.0466], [3, 0.0405], [4, 0.036], [5, 0.0717], [6, 0.0444]]
SELECT service_id, ROUND(1.0 * SUM(failures) / SUM(requests), 4) AS failure_rate FROM daily_metrics WHERE requests > 0 AND failures IS NOT NULL GROUP BY service_id HAVING COUNT(*) >= 5
overdue_invoices
train
42
As of 2025-07-01, find issued invoices with due_date strictly earlier than that date and positive outstanding balance. Outstanding balance is invoice amount minus settled payments minus approved credits. Missing payments or credits count as zero; pending records and void invoices do not count. Columns: invoice_id, cust...
CREATE TABLE invoices(invoice_id INTEGER PRIMARY KEY, customer_id INTEGER NOT NULL, amount_cents INTEGER NOT NULL, due_date TEXT NOT NULL, status TEXT NOT NULL); CREATE TABLE payments(payment_id INTEGER PRIMARY KEY, invoice_id INTEGER NOT NULL, amount_cents INTEGER NOT NULL, status TEXT NOT NULL); CREAT...
[[1, 6, 9399], [3, 2, 3085], [4, 3, 1337], [7, 1, 1806], [8, 5, 501]]
WITH paid AS (SELECT invoice_id, SUM(amount_cents) AS amount FROM payments WHERE status = 'settled' GROUP BY invoice_id), credited AS (SELECT invoice_id, SUM(amount_cents) AS amount FROM credits WHERE status = 'approved' GROUP BY invoice_id), balances AS ( SELECT i.invoice_id, i.customer_id,...
treatment_effects
train
42
For each treatment, calculate mean within-participant change (followup minus baseline). First average all non-NULL replicate readings for each participant and phase. Include only participants with at least one non-NULL reading in both phases, then average their changes, giving each participant equal weight. Omit treatm...
CREATE TABLE participants(participant_id INTEGER PRIMARY KEY, treatment TEXT NOT NULL); CREATE TABLE readings(reading_id INTEGER PRIMARY KEY, participant_id INTEGER NOT NULL, phase TEXT NOT NULL, value INTEGER); -- participants: 18 rows -- readings: 57 rows
[["control", 4.208], ["high_dose", -11.333], ["low_dose", -5.333]]
WITH means AS ( SELECT participant_id, phase, AVG(value) AS mean_value FROM readings WHERE value IS NOT NULL GROUP BY participant_id, phase ), changes AS ( SELECT participant_id, MAX(CASE WHEN phase = 'followup' THEN mean_value END) - MAX(CASE WHEN phase = 'ba...
signup_cohorts
train
42
Summarize each signup-month cohort. A repeat buyer has at least two completed purchases on or after signup_at and strictly before signup_at + 30 days. All signed-up users belong in the denominator, including users with no purchases. Ignore cancelled purchases and records before signup. Columns: cohort_month (YYYY-MM), ...
CREATE TABLE users(user_id INTEGER PRIMARY KEY, signup_at TEXT NOT NULL); CREATE TABLE purchases(purchase_id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, purchased_at TEXT NOT NULL, status TEXT NOT NULL); -- users: 18 rows -- purchases: 36 rows
[["2025-03", 6, 2, 0.3333], ["2025-04", 6, 1, 0.1667], ["2025-05", 6, 2, 0.3333]]
WITH user_counts AS ( SELECT u.user_id, SUBSTR(u.signup_at, 1, 7) AS cohort_month, COUNT(p.purchase_id) AS purchases FROM users u LEFT JOIN purchases p ON p.user_id = u.user_id AND p.status = 'completed' AND p.purchased_at >= u.signup_at AND p.purchased_at < DATE(u.signup_at, '+3...
missing_inspections
train
42
As of 2025-07-01 inclusive, find machines with a completed repair but no passing inspection on or after their latest completed repair. Repairs marked cancelled do not count. Ignore all repairs and inspections after the as-of date; a passing inspection on the repair date is sufficient. Exclude machines with no completed...
CREATE TABLE machines(machine_id INTEGER PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE repairs(repair_id INTEGER PRIMARY KEY, machine_id INTEGER NOT NULL, repaired_at TEXT NOT NULL, status TEXT NOT NULL); CREATE TABLE inspections(inspection_id INTEGER PRIMARY KEY, machine_id INTEGER NOT NULL, inspected...
[[1, "2025-06-18"], [2, "2025-06-28"], [4, "2025-06-28"], [5, "2025-06-25"], [7, "2025-06-25"], [10, "2025-06-30"]]
WITH latest AS ( SELECT machine_id, MAX(repaired_at) AS last_repair_date FROM repairs WHERE status = 'completed' AND repaired_at <= '2025-07-01' GROUP BY machine_id ) SELECT l.machine_id, l.last_repair_date FROM latest l WHERE NOT EXISTS ( SELECT 1 FROM inspections i WHERE i....
latency_regressions
train
42
For each region, return exactly two services with the largest latency increase after deployment. Increase is mean after latency minus mean before latency, using all samples in each phase. Rank on the unrounded increase descending and break ties by service_id ascending. Negative increases remain eligible. Columns: regio...
CREATE TABLE services(service_id INTEGER PRIMARY KEY, region TEXT NOT NULL); CREATE TABLE latency_samples(sample_id INTEGER PRIMARY KEY, service_id INTEGER NOT NULL, phase TEXT NOT NULL, latency_ms INTEGER NOT NULL); -- services: 12 rows -- latency_samples: 48 rows
[["central", 10, 69.0], ["central", 11, 50.0], ["east", 2, 78.0], ["east", 3, 52.5], ["west", 8, 77.5], ["west", 5, 67.5]]
WITH changes AS ( SELECT s.region, s.service_id, AVG(CASE WHEN l.phase = 'after' THEN l.latency_ms END) - AVG(CASE WHEN l.phase = 'before' THEN l.latency_ms END) AS increase FROM services s JOIN latency_samples l USING(service_id) GROUP BY s.region, s.service_id ), ranked...
delivery_streaks
train
42
For every driver, find the longest streak of consecutive scheduled jobs delivered on time. Order each driver's jobs by scheduled_at ascending, then job_id ascending. A job is on time only if status = 'delivered' and delivered_at <= due_at. A cancelled job, late delivery, or missing delivered_at breaks the streak. Calen...
CREATE TABLE drivers(driver_id INTEGER PRIMARY KEY, name TEXT NOT NULL); CREATE TABLE jobs(job_id INTEGER PRIMARY KEY, driver_id INTEGER NOT NULL, scheduled_at TEXT NOT NULL, due_at TEXT NOT NULL, delivered_at TEXT, status TEXT NOT NULL); -- drivers: 6 rows -- jobs: 60 rows
[[1, 2], [2, 3], [3, 4], [4, 2], [5, 2], [6, 1]]
WITH flags AS ( SELECT *, CASE WHEN status = 'delivered' AND delivered_at <= due_at THEN 1 ELSE 0 END AS on_time FROM jobs ), islands AS ( SELECT *, SUM(1 - on_time) OVER (PARTITION BY driver_id ORDER BY scheduled_at, job_id ROWS UNBOUNDED PRECEDING) AS streak_group FROM flags ),...
currency_conversion
train
42
Convert settled transactions to USD, then total by currency. For each transaction use that currency's latest exchange rate with effective_at on or before occurred_at. amount_minor is in hundredths of the source currency, including for JPY; usd_micros_per_unit is millionths of a USD per one source-currency unit. Negativ...
CREATE TABLE exchange_rates(currency TEXT NOT NULL, effective_at TEXT NOT NULL, usd_micros_per_unit INTEGER NOT NULL, PRIMARY KEY(currency, effective_at)); CREATE TABLE transactions(transaction_id INTEGER PRIMARY KEY, currency TEXT NOT NULL, occurred_at TEXT NOT NULL, amount_minor INTEGER NOT NULL, status TEXT ...
[["EUR", 578.26], ["GBP", 813.19], ["JPY", 4.23]]
SELECT t.currency, ROUND(1.0 * SUM(t.amount_minor * r.usd_micros_per_unit) / 100000000, 2) AS total_usd FROM transactions t JOIN exchange_rates r ON r.currency = t.currency AND r.effective_at = ( SELECT MAX(r2.effective_at) FROM exchange_rates r2 WHERE r2.currency = t.currency AND r2.effective_at <=...

OpenEnv SQL Investigation

Ten original procedural SQL investigation families teach joins, duplicate-safe aggregation, missing-data handling, weighted rates, temporal conditions, cohorts, anti-joins, ranking, and streak analysis. All data are synthetic and generated locally; there are no personal data or downloaded task assets.

The container generates a fresh in-memory SQLite database on every unseeded reset. tasks.jsonl contains one reproducible seed-42 instance per family, with instructions, schema, reference SQL and independently calculated Python answers serialized in expected_rows_json. data/*.sql reconstruct those public example databases. source/ contains the environment, generator, tests and container recipe from source commit 979946ef5fc6a5ad0bb661073af5e74a56127ea6. Explicit reset seeds reproduce an instance; normal training samples fresh 63-bit seeds.

The policy sees only its question, schema, and its own query results. It can use read-only SQLite queries and has 12 actions. op=submit executes final SQL and ends the episode. Reward is 1 only for the entire correct result table, otherwise 0; row order is ignored, duplicate multiplicity and column position matter, and numeric absolute tolerance is 0.0001. Python computes the expected rows independently of the submitted SQL. op=finish, budget exhaustion, or an invalid final query earns 0. There is no partial credit.

The public reference solutions are intended for audit and reproducibility. The runtime does not expose them through SQL tables or policy observations. SQL file access, writes, database attachment and extensions are denied; function, statement length, result length, execution-time and VM-operation limits bound each query.

All ten families are training tasks for one Arena policy. This dataset does not contain Arena's private evaluation tasks, and no private evaluation improvement is claimed. The common admission example finishes with reward 0; separate oracle tests demonstrate reward 1 for correct solutions.

Image: ghcr.io/burtenshaw/openenv-sql-investigation:v1. The Arena submission pins an immutable image digest. OpenEnv is pinned to 86a180ede21e044f7929b9a7783ad83aa67d83a3; the image is self-contained and requires no secrets, files, volumes, GPU or external downloads at runtime.

Downloads last month
-