variant
stringclasses
3 values
prompt
stringlengths
163
237
sql
stringlengths
103
143
metadata
unknown
id
stringlengths
21
21
split
stringclasses
1 value
token_group
stringclasses
2 values
v3
Schema: invoices (alias: inv)(status, amount, value, salary) schedules(date, id, salary, name) Task: Find name from invoices where value exceeds the average salary from schedules for the same status. SQL:
SELECT name FROM invoices AS inv WHERE value > ( SELECT MIN(salary) FROM schedules AS schd WHERE schd.status = inv.status );
{ "outer_table": "invoices", "inner_table": "schedules", "outer_alias": "inv", "inner_alias": "schd", "proj_col": "name", "filter_col": "value", "agg_col": "salary", "agg_fn": "MIN", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_fixed_train_01800
train
T1
v2
Schema: regions (alias: rgn)(level, salary, value, date) customers(id, code, salary, status) Task: Retrieve code from regions that have at least one corresponding entry in customers sharing the same level. SQL:
SELECT code FROM regions AS rgn WHERE EXISTS ( SELECT 1 FROM customers AS cust WHERE cust.level = rgn.level );
{ "outer_table": "regions", "inner_table": "customers", "outer_alias": "rgn", "inner_alias": "cust", "proj_col": "code", "join_col": "level", "correlated_ref": "rgn.level", "token_group": "T2" }
cs8_fixed_train_01801
train
T2
v3
Schema: services (alias: srvc)(value, type, level, salary) invoices(type, name, code, value) Task: Retrieve amount from services with value above the SUM(salary) of invoices rows sharing the same id. SQL:
SELECT amount FROM services AS srvc WHERE value > ( SELECT SUM(salary) FROM invoices AS inv WHERE inv.id = srvc.id );
{ "outer_table": "services", "inner_table": "invoices", "outer_alias": "srvc", "inner_alias": "inv", "proj_col": "amount", "filter_col": "value", "agg_col": "salary", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "srvc.id", "token_group": "T2" }
cs8_fixed_train_01802
train
T2
v3
Schema: departments (alias: dept)(level, id, value, amount) shipments(amount, code, name, value) Task: Find code from departments where value exceeds the average value from shipments for the same id. SQL:
SELECT code FROM departments AS dept WHERE value > ( SELECT SUM(value) FROM shipments AS shp WHERE shp.id = dept.id );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "dept", "inner_alias": "shp", "proj_col": "code", "filter_col": "value", "agg_col": "value", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_fixed_train_01803
train
T1
v3
Schema: budgets (alias: budg)(id, date, level, code) items(id, level, type, name) Task: Find id from budgets where value exceeds the average value from items for the same level. SQL:
SELECT id FROM budgets AS budg WHERE value > ( SELECT SUM(value) FROM items AS lne WHERE lne.level = budg.level );
{ "outer_table": "budgets", "inner_table": "items", "outer_alias": "budg", "inner_alias": "lne", "proj_col": "id", "filter_col": "value", "agg_col": "value", "agg_fn": "SUM", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_fixed_train_01804
train
T2
v3
Schema: orders (alias: ord)(amount, code, type, value) products(code, value, salary, name) Task: Retrieve code from orders with amount above the MAX(value) of products rows sharing the same level. SQL:
SELECT code FROM orders AS ord WHERE amount > ( SELECT MAX(value) FROM products AS prod WHERE prod.level = ord.level );
{ "outer_table": "orders", "inner_table": "products", "outer_alias": "ord", "inner_alias": "prod", "proj_col": "code", "filter_col": "amount", "agg_col": "value", "agg_fn": "MAX", "join_col": "level", "correlated_ref": "ord.level", "token_group": "T1" }
cs8_fixed_train_01805
train
T1
v1
Schema: customers (alias: cust)(salary, date, name, id) budgets(status, salary, name, amount) Task: Retrieve code from customers whose level is found in budgets rows where level matches the outer record. SQL:
SELECT code FROM customers AS cust WHERE level IN ( SELECT level FROM budgets AS budg WHERE budg.level = cust.level );
{ "outer_table": "customers", "inner_table": "budgets", "outer_alias": "cust", "inner_alias": "budg", "proj_col": "code", "filter_col": "level", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_fixed_train_01806
train
T1
v1
Schema: sales (alias: sale)(status, value, date, name) orders(status, id, name, date) Task: Retrieve value from sales whose type is found in orders rows where level matches the outer record. SQL:
SELECT value FROM sales AS sale WHERE type IN ( SELECT type FROM orders AS ord WHERE ord.level = sale.level );
{ "outer_table": "sales", "inner_table": "orders", "outer_alias": "sale", "inner_alias": "ord", "proj_col": "value", "filter_col": "type", "join_col": "level", "correlated_ref": "sale.level", "token_group": "T1" }
cs8_fixed_train_01807
train
T1
v1
Schema: accounts (alias: acct)(date, id, type, code) warehouses(date, type, value, status) Task: Find salary from accounts where code appears in warehouses entries with matching status. SQL:
SELECT salary FROM accounts AS acct WHERE code IN ( SELECT code FROM warehouses AS whs WHERE whs.status = acct.status );
{ "outer_table": "accounts", "inner_table": "warehouses", "outer_alias": "acct", "inner_alias": "whs", "proj_col": "salary", "filter_col": "code", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_fixed_train_01808
train
T1
v2
Schema: departments (alias: dept)(date, amount, id, value) orders(type, salary, id, level) Task: Retrieve name from departments that have at least one corresponding entry in orders sharing the same code. SQL:
SELECT name FROM departments AS dept WHERE EXISTS ( SELECT 1 FROM orders AS ord WHERE ord.code = dept.code );
{ "outer_table": "departments", "inner_table": "orders", "outer_alias": "dept", "inner_alias": "ord", "proj_col": "name", "join_col": "code", "correlated_ref": "dept.code", "token_group": "T1" }
cs8_fixed_train_01809
train
T1
v2
Schema: sales (alias: sale)(amount, id, salary, value) services(code, id, date, salary) Task: Retrieve value from sales that have at least one corresponding entry in services sharing the same id. SQL:
SELECT value FROM sales AS sale WHERE EXISTS ( SELECT 1 FROM services AS srvc WHERE srvc.id = sale.id );
{ "outer_table": "sales", "inner_table": "services", "outer_alias": "sale", "inner_alias": "srvc", "proj_col": "value", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_fixed_train_01810
train
T1
v2
Schema: warehouses (alias: whs)(date, salary, value, status) items(id, type, salary, amount) Task: Retrieve salary from warehouses that have at least one corresponding entry in items sharing the same status. SQL:
SELECT salary FROM warehouses AS whs WHERE EXISTS ( SELECT 1 FROM items AS lne WHERE lne.status = whs.status );
{ "outer_table": "warehouses", "inner_table": "items", "outer_alias": "whs", "inner_alias": "lne", "proj_col": "salary", "join_col": "status", "correlated_ref": "whs.status", "token_group": "T2" }
cs8_fixed_train_01811
train
T2
v2
Schema: items (alias: lne)(salary, code, level, date) transactions(status, value, type, date) Task: Find id from items where a matching record exists in transactions with the same level. SQL:
SELECT id FROM items AS lne WHERE EXISTS ( SELECT 1 FROM transactions AS txn WHERE txn.level = lne.level );
{ "outer_table": "items", "inner_table": "transactions", "outer_alias": "lne", "inner_alias": "txn", "proj_col": "id", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_fixed_train_01812
train
T2
v2
Schema: warehouses (alias: whs)(level, salary, status, name) items(salary, type, id, level) Task: Retrieve amount from warehouses that have at least one corresponding entry in items sharing the same level. SQL:
SELECT amount FROM warehouses AS whs WHERE EXISTS ( SELECT 1 FROM items AS lne WHERE lne.level = whs.level );
{ "outer_table": "warehouses", "inner_table": "items", "outer_alias": "whs", "inner_alias": "lne", "proj_col": "amount", "join_col": "level", "correlated_ref": "whs.level", "token_group": "T2" }
cs8_fixed_train_01813
train
T2
v1
Schema: departments (alias: dept)(date, type, status, amount) invoices(code, name, type, salary) Task: Select salary from departments where code exists in invoices for the same level. SQL:
SELECT salary FROM departments AS dept WHERE code IN ( SELECT code FROM invoices AS inv WHERE inv.level = dept.level );
{ "outer_table": "departments", "inner_table": "invoices", "outer_alias": "dept", "inner_alias": "inv", "proj_col": "salary", "filter_col": "code", "join_col": "level", "correlated_ref": "dept.level", "token_group": "T1" }
cs8_fixed_train_01814
train
T1
v2
Schema: services (alias: srvc)(status, name, salary, type) categories(date, salary, status, level) Task: Retrieve salary from services that have at least one corresponding entry in categories sharing the same code. SQL:
SELECT salary FROM services AS srvc WHERE EXISTS ( SELECT 1 FROM categories AS catg WHERE catg.code = srvc.code );
{ "outer_table": "services", "inner_table": "categories", "outer_alias": "srvc", "inner_alias": "catg", "proj_col": "salary", "join_col": "code", "correlated_ref": "srvc.code", "token_group": "T2" }
cs8_fixed_train_01815
train
T2
v2
Schema: items (alias: lne)(status, id, date, value) departments(id, level, name, date) Task: Retrieve amount from items that have at least one corresponding entry in departments sharing the same type. SQL:
SELECT amount FROM items AS lne WHERE EXISTS ( SELECT 1 FROM departments AS dept WHERE dept.type = lne.type );
{ "outer_table": "items", "inner_table": "departments", "outer_alias": "lne", "inner_alias": "dept", "proj_col": "amount", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_fixed_train_01816
train
T2
v1
Schema: managers (alias: mgr)(date, amount, code, value) requests(date, code, salary, name) Task: Retrieve code from managers whose id is found in requests rows where id matches the outer record. SQL:
SELECT code FROM managers AS mgr WHERE id IN ( SELECT id FROM requests AS ordr WHERE ordr.id = mgr.id );
{ "outer_table": "managers", "inner_table": "requests", "outer_alias": "mgr", "inner_alias": "ordr", "proj_col": "code", "filter_col": "id", "join_col": "id", "correlated_ref": "mgr.id", "token_group": "T1" }
cs8_fixed_train_01817
train
T1
v3
Schema: shipments (alias: shp)(salary, value, level, id) customers(salary, type, value, date) Task: Retrieve salary from shipments with amount above the AVG(amount) of customers rows sharing the same status. SQL:
SELECT salary FROM shipments AS shp WHERE amount > ( SELECT AVG(amount) FROM customers AS cust WHERE cust.status = shp.status );
{ "outer_table": "shipments", "inner_table": "customers", "outer_alias": "shp", "inner_alias": "cust", "proj_col": "salary", "filter_col": "amount", "agg_col": "amount", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_fixed_train_01818
train
T2
v2
Schema: managers (alias: mgr)(amount, code, date, salary) employees(id, code, value, type) Task: Find salary from managers where a matching record exists in employees with the same id. SQL:
SELECT salary FROM managers AS mgr WHERE EXISTS ( SELECT 1 FROM employees AS emp WHERE emp.id = mgr.id );
{ "outer_table": "managers", "inner_table": "employees", "outer_alias": "mgr", "inner_alias": "emp", "proj_col": "salary", "join_col": "id", "correlated_ref": "mgr.id", "token_group": "T1" }
cs8_fixed_train_01819
train
T1
v3
Schema: warehouses (alias: whs)(id, value, status, type) items(id, amount, code, type) Task: Find salary from warehouses where value exceeds the average amount from items for the same code. SQL:
SELECT salary FROM warehouses AS whs WHERE value > ( SELECT MIN(amount) FROM items AS lne WHERE lne.code = whs.code );
{ "outer_table": "warehouses", "inner_table": "items", "outer_alias": "whs", "inner_alias": "lne", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "MIN", "join_col": "code", "correlated_ref": "whs.code", "token_group": "T2" }
cs8_fixed_train_01820
train
T2
v1
Schema: schedules (alias: schd)(type, name, amount, id) orders(status, type, level, id) Task: Retrieve code from schedules whose type is found in orders rows where code matches the outer record. SQL:
SELECT code FROM schedules AS schd WHERE type IN ( SELECT type FROM orders AS ord WHERE ord.code = schd.code );
{ "outer_table": "schedules", "inner_table": "orders", "outer_alias": "schd", "inner_alias": "ord", "proj_col": "code", "filter_col": "type", "join_col": "code", "correlated_ref": "schd.code", "token_group": "T2" }
cs8_fixed_train_01821
train
T2
v1
Schema: schedules (alias: schd)(id, amount, status, name) invoices(id, status, value, level) Task: Find id from schedules where status appears in invoices entries with matching id. SQL:
SELECT id FROM schedules AS schd WHERE status IN ( SELECT status FROM invoices AS inv WHERE inv.id = schd.id );
{ "outer_table": "schedules", "inner_table": "invoices", "outer_alias": "schd", "inner_alias": "inv", "proj_col": "id", "filter_col": "status", "join_col": "id", "correlated_ref": "schd.id", "token_group": "T2" }
cs8_fixed_train_01822
train
T2
v1
Schema: accounts (alias: acct)(salary, amount, status, name) regions(code, level, value, salary) Task: Retrieve value from accounts whose level is found in regions rows where status matches the outer record. SQL:
SELECT value FROM accounts AS acct WHERE level IN ( SELECT level FROM regions AS rgn WHERE rgn.status = acct.status );
{ "outer_table": "accounts", "inner_table": "regions", "outer_alias": "acct", "inner_alias": "rgn", "proj_col": "value", "filter_col": "level", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_fixed_train_01823
train
T1
v1
Schema: staff (alias: empl)(level, status, amount, type) customers(status, value, level, code) Task: Retrieve amount from staff whose level is found in customers rows where id matches the outer record. SQL:
SELECT amount FROM staff AS empl WHERE level IN ( SELECT level FROM customers AS cust WHERE cust.id = empl.id );
{ "outer_table": "staff", "inner_table": "customers", "outer_alias": "empl", "inner_alias": "cust", "proj_col": "amount", "filter_col": "level", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_fixed_train_01824
train
T2
v1
Schema: transactions (alias: txn)(name, status, id, date) regions(salary, date, type, value) Task: Retrieve id from transactions whose code is found in regions rows where status matches the outer record. SQL:
SELECT id FROM transactions AS txn WHERE code IN ( SELECT code FROM regions AS rgn WHERE rgn.status = txn.status );
{ "outer_table": "transactions", "inner_table": "regions", "outer_alias": "txn", "inner_alias": "rgn", "proj_col": "id", "filter_col": "code", "join_col": "status", "correlated_ref": "txn.status", "token_group": "T1" }
cs8_fixed_train_01825
train
T1
v3
Schema: accounts (alias: acct)(value, level, amount, id) managers(type, date, code, amount) Task: Find amount from accounts where amount exceeds the average salary from managers for the same status. SQL:
SELECT amount FROM accounts AS acct WHERE amount > ( SELECT COUNT(salary) FROM managers AS mgr WHERE mgr.status = acct.status );
{ "outer_table": "accounts", "inner_table": "managers", "outer_alias": "acct", "inner_alias": "mgr", "proj_col": "amount", "filter_col": "amount", "agg_col": "salary", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_fixed_train_01826
train
T1
v2
Schema: accounts (alias: acct)(code, value, amount, name) warehouses(salary, level, date, type) Task: Retrieve id from accounts that have at least one corresponding entry in warehouses sharing the same code. SQL:
SELECT id FROM accounts AS acct WHERE EXISTS ( SELECT 1 FROM warehouses AS whs WHERE whs.code = acct.code );
{ "outer_table": "accounts", "inner_table": "warehouses", "outer_alias": "acct", "inner_alias": "whs", "proj_col": "id", "join_col": "code", "correlated_ref": "acct.code", "token_group": "T1" }
cs8_fixed_train_01827
train
T1
v3
Schema: requests (alias: ordr)(name, id, salary, level) invoices(amount, value, level, type) Task: Find amount from requests where salary exceeds the average value from invoices for the same id. SQL:
SELECT amount FROM requests AS ordr WHERE salary > ( SELECT MAX(value) FROM invoices AS inv WHERE inv.id = ordr.id );
{ "outer_table": "requests", "inner_table": "invoices", "outer_alias": "ordr", "inner_alias": "inv", "proj_col": "amount", "filter_col": "salary", "agg_col": "value", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "ordr.id", "token_group": "T2" }
cs8_fixed_train_01828
train
T2
v1
Schema: invoices (alias: inv)(status, name, type, code) employees(code, id, date, type) Task: Select amount from invoices where id exists in employees for the same level. SQL:
SELECT amount FROM invoices AS inv WHERE id IN ( SELECT id FROM employees AS emp WHERE emp.level = inv.level );
{ "outer_table": "invoices", "inner_table": "employees", "outer_alias": "inv", "inner_alias": "emp", "proj_col": "amount", "filter_col": "id", "join_col": "level", "correlated_ref": "inv.level", "token_group": "T1" }
cs8_fixed_train_01829
train
T1
v1
Schema: products (alias: prod)(name, type, id, status) requests(id, type, value, level) Task: Find name from products where type appears in requests entries with matching code. SQL:
SELECT name FROM products AS prod WHERE type IN ( SELECT type FROM requests AS ordr WHERE ordr.code = prod.code );
{ "outer_table": "products", "inner_table": "requests", "outer_alias": "prod", "inner_alias": "ordr", "proj_col": "name", "filter_col": "type", "join_col": "code", "correlated_ref": "prod.code", "token_group": "T1" }
cs8_fixed_train_01830
train
T1
v2
Schema: customers (alias: cust)(id, date, salary, level) schedules(salary, name, type, id) Task: Find id from customers where a matching record exists in schedules with the same id. SQL:
SELECT id FROM customers AS cust WHERE EXISTS ( SELECT 1 FROM schedules AS schd WHERE schd.id = cust.id );
{ "outer_table": "customers", "inner_table": "schedules", "outer_alias": "cust", "inner_alias": "schd", "proj_col": "id", "join_col": "id", "correlated_ref": "cust.id", "token_group": "T1" }
cs8_fixed_train_01831
train
T1
v1
Schema: staff (alias: empl)(id, date, type, status) accounts(id, value, amount, type) Task: Find name from staff where type appears in accounts entries with matching status. SQL:
SELECT name FROM staff AS empl WHERE type IN ( SELECT type FROM accounts AS acct WHERE acct.status = empl.status );
{ "outer_table": "staff", "inner_table": "accounts", "outer_alias": "empl", "inner_alias": "acct", "proj_col": "name", "filter_col": "type", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_fixed_train_01832
train
T2
v2
Schema: requests (alias: ordr)(amount, date, value, type) managers(amount, value, type, salary) Task: Retrieve code from requests that have at least one corresponding entry in managers sharing the same code. SQL:
SELECT code FROM requests AS ordr WHERE EXISTS ( SELECT 1 FROM managers AS mgr WHERE mgr.code = ordr.code );
{ "outer_table": "requests", "inner_table": "managers", "outer_alias": "ordr", "inner_alias": "mgr", "proj_col": "code", "join_col": "code", "correlated_ref": "ordr.code", "token_group": "T2" }
cs8_fixed_train_01833
train
T2
v3
Schema: customers (alias: cust)(level, value, amount, status) shipments(type, salary, level, name) Task: Find code from customers where salary exceeds the average amount from shipments for the same level. SQL:
SELECT code FROM customers AS cust WHERE salary > ( SELECT AVG(amount) FROM shipments AS shp WHERE shp.level = cust.level );
{ "outer_table": "customers", "inner_table": "shipments", "outer_alias": "cust", "inner_alias": "shp", "proj_col": "code", "filter_col": "salary", "agg_col": "amount", "agg_fn": "AVG", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_fixed_train_01834
train
T1
v2
Schema: items (alias: lne)(status, code, amount, level) employees(date, level, status, value) Task: Retrieve amount from items that have at least one corresponding entry in employees sharing the same type. SQL:
SELECT amount FROM items AS lne WHERE EXISTS ( SELECT 1 FROM employees AS emp WHERE emp.type = lne.type );
{ "outer_table": "items", "inner_table": "employees", "outer_alias": "lne", "inner_alias": "emp", "proj_col": "amount", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_fixed_train_01835
train
T2
v3
Schema: staff (alias: empl)(type, name, salary, status) requests(level, code, value, type) Task: Retrieve code from staff with salary above the AVG(salary) of requests rows sharing the same type. SQL:
SELECT code FROM staff AS empl WHERE salary > ( SELECT AVG(salary) FROM requests AS ordr WHERE ordr.type = empl.type );
{ "outer_table": "staff", "inner_table": "requests", "outer_alias": "empl", "inner_alias": "ordr", "proj_col": "code", "filter_col": "salary", "agg_col": "salary", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "empl.type", "token_group": "T2" }
cs8_fixed_train_01836
train
T2
v2
Schema: customers (alias: cust)(amount, level, status, name) managers(value, level, salary, status) Task: Retrieve value from customers that have at least one corresponding entry in managers sharing the same code. SQL:
SELECT value FROM customers AS cust WHERE EXISTS ( SELECT 1 FROM managers AS mgr WHERE mgr.code = cust.code );
{ "outer_table": "customers", "inner_table": "managers", "outer_alias": "cust", "inner_alias": "mgr", "proj_col": "value", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_fixed_train_01837
train
T1
v3
Schema: managers (alias: mgr)(type, salary, id, amount) requests(code, value, level, salary) Task: Find value from managers where salary exceeds the average value from requests for the same code. SQL:
SELECT value FROM managers AS mgr WHERE salary > ( SELECT SUM(value) FROM requests AS ordr WHERE ordr.code = mgr.code );
{ "outer_table": "managers", "inner_table": "requests", "outer_alias": "mgr", "inner_alias": "ordr", "proj_col": "value", "filter_col": "salary", "agg_col": "value", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "mgr.code", "token_group": "T1" }
cs8_fixed_train_01838
train
T1
v2
Schema: budgets (alias: budg)(status, value, amount, id) schedules(code, level, type, value) Task: Retrieve id from budgets that have at least one corresponding entry in schedules sharing the same status. SQL:
SELECT id FROM budgets AS budg WHERE EXISTS ( SELECT 1 FROM schedules AS schd WHERE schd.status = budg.status );
{ "outer_table": "budgets", "inner_table": "schedules", "outer_alias": "budg", "inner_alias": "schd", "proj_col": "id", "join_col": "status", "correlated_ref": "budg.status", "token_group": "T2" }
cs8_fixed_train_01839
train
T2
v3
Schema: accounts (alias: acct)(code, salary, id, status) departments(name, id, type, status) Task: Retrieve salary from accounts with salary above the AVG(value) of departments rows sharing the same id. SQL:
SELECT salary FROM accounts AS acct WHERE salary > ( SELECT AVG(value) FROM departments AS dept WHERE dept.id = acct.id );
{ "outer_table": "accounts", "inner_table": "departments", "outer_alias": "acct", "inner_alias": "dept", "proj_col": "salary", "filter_col": "salary", "agg_col": "value", "agg_fn": "AVG", "join_col": "id", "correlated_ref": "acct.id", "token_group": "T1" }
cs8_fixed_train_01840
train
T1
v2
Schema: departments (alias: dept)(amount, status, id, date) shipments(type, name, status, amount) Task: Retrieve value from departments that have at least one corresponding entry in shipments sharing the same code. SQL:
SELECT value FROM departments AS dept WHERE EXISTS ( SELECT 1 FROM shipments AS shp WHERE shp.code = dept.code );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "dept", "inner_alias": "shp", "proj_col": "value", "join_col": "code", "correlated_ref": "dept.code", "token_group": "T1" }
cs8_fixed_train_01841
train
T1
v3
Schema: customers (alias: cust)(code, date, amount, type) categories(type, name, id, value) Task: Retrieve name from customers with amount above the MIN(value) of categories rows sharing the same code. SQL:
SELECT name FROM customers AS cust WHERE amount > ( SELECT MIN(value) FROM categories AS catg WHERE catg.code = cust.code );
{ "outer_table": "customers", "inner_table": "categories", "outer_alias": "cust", "inner_alias": "catg", "proj_col": "name", "filter_col": "amount", "agg_col": "value", "agg_fn": "MIN", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_fixed_train_01842
train
T1
v2
Schema: customers (alias: cust)(date, code, type, name) regions(level, type, code, salary) Task: Retrieve id from customers that have at least one corresponding entry in regions sharing the same level. SQL:
SELECT id FROM customers AS cust WHERE EXISTS ( SELECT 1 FROM regions AS rgn WHERE rgn.level = cust.level );
{ "outer_table": "customers", "inner_table": "regions", "outer_alias": "cust", "inner_alias": "rgn", "proj_col": "id", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_fixed_train_01843
train
T1
v3
Schema: regions (alias: rgn)(amount, name, type, value) customers(status, date, level, code) Task: Find value from regions where salary exceeds the average amount from customers for the same type. SQL:
SELECT value FROM regions AS rgn WHERE salary > ( SELECT COUNT(amount) FROM customers AS cust WHERE cust.type = rgn.type );
{ "outer_table": "regions", "inner_table": "customers", "outer_alias": "rgn", "inner_alias": "cust", "proj_col": "value", "filter_col": "salary", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "type", "correlated_ref": "rgn.type", "token_group": "T2" }
cs8_fixed_train_01844
train
T2
v1
Schema: accounts (alias: acct)(status, value, date, id) regions(name, code, status, type) Task: Retrieve id from accounts whose level is found in regions rows where type matches the outer record. SQL:
SELECT id FROM accounts AS acct WHERE level IN ( SELECT level FROM regions AS rgn WHERE rgn.type = acct.type );
{ "outer_table": "accounts", "inner_table": "regions", "outer_alias": "acct", "inner_alias": "rgn", "proj_col": "id", "filter_col": "level", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_fixed_train_01845
train
T1
v2
Schema: sales (alias: sale)(value, status, name, id) warehouses(value, name, date, code) Task: Find amount from sales where a matching record exists in warehouses with the same id. SQL:
SELECT amount FROM sales AS sale WHERE EXISTS ( SELECT 1 FROM warehouses AS whs WHERE whs.id = sale.id );
{ "outer_table": "sales", "inner_table": "warehouses", "outer_alias": "sale", "inner_alias": "whs", "proj_col": "amount", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_fixed_train_01846
train
T1
v3
Schema: categories (alias: catg)(name, level, id, value) orders(level, status, id, code) Task: Retrieve name from categories with amount above the MIN(salary) of orders rows sharing the same id. SQL:
SELECT name FROM categories AS catg WHERE amount > ( SELECT MIN(salary) FROM orders AS ord WHERE ord.id = catg.id );
{ "outer_table": "categories", "inner_table": "orders", "outer_alias": "catg", "inner_alias": "ord", "proj_col": "name", "filter_col": "amount", "agg_col": "salary", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "catg.id", "token_group": "T2" }
cs8_fixed_train_01847
train
T2
v2
Schema: sales (alias: sale)(date, amount, name, level) schedules(date, salary, level, value) Task: Retrieve id from sales that have at least one corresponding entry in schedules sharing the same id. SQL:
SELECT id FROM sales AS sale WHERE EXISTS ( SELECT 1 FROM schedules AS schd WHERE schd.id = sale.id );
{ "outer_table": "sales", "inner_table": "schedules", "outer_alias": "sale", "inner_alias": "schd", "proj_col": "id", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_fixed_train_01848
train
T1
v2
Schema: warehouses (alias: whs)(salary, type, status, level) categories(date, level, value, id) Task: Retrieve salary from warehouses that have at least one corresponding entry in categories sharing the same code. SQL:
SELECT salary FROM warehouses AS whs WHERE EXISTS ( SELECT 1 FROM categories AS catg WHERE catg.code = whs.code );
{ "outer_table": "warehouses", "inner_table": "categories", "outer_alias": "whs", "inner_alias": "catg", "proj_col": "salary", "join_col": "code", "correlated_ref": "whs.code", "token_group": "T2" }
cs8_fixed_train_01849
train
T2
v1
Schema: warehouses (alias: whs)(value, salary, level, status) managers(code, value, status, amount) Task: Find salary from warehouses where code appears in managers entries with matching level. SQL:
SELECT salary FROM warehouses AS whs WHERE code IN ( SELECT code FROM managers AS mgr WHERE mgr.level = whs.level );
{ "outer_table": "warehouses", "inner_table": "managers", "outer_alias": "whs", "inner_alias": "mgr", "proj_col": "salary", "filter_col": "code", "join_col": "level", "correlated_ref": "whs.level", "token_group": "T2" }
cs8_fixed_train_01850
train
T2
v3
Schema: sales (alias: sale)(salary, name, code, amount) customers(name, type, salary, amount) Task: Retrieve id from sales with value above the SUM(amount) of customers rows sharing the same status. SQL:
SELECT id FROM sales AS sale WHERE value > ( SELECT SUM(amount) FROM customers AS cust WHERE cust.status = sale.status );
{ "outer_table": "sales", "inner_table": "customers", "outer_alias": "sale", "inner_alias": "cust", "proj_col": "id", "filter_col": "value", "agg_col": "amount", "agg_fn": "SUM", "join_col": "status", "correlated_ref": "sale.status", "token_group": "T1" }
cs8_fixed_train_01851
train
T1
v2
Schema: staff (alias: empl)(value, type, salary, date) items(code, status, amount, salary) Task: Retrieve value from staff that have at least one corresponding entry in items sharing the same code. SQL:
SELECT value FROM staff AS empl WHERE EXISTS ( SELECT 1 FROM items AS lne WHERE lne.code = empl.code );
{ "outer_table": "staff", "inner_table": "items", "outer_alias": "empl", "inner_alias": "lne", "proj_col": "value", "join_col": "code", "correlated_ref": "empl.code", "token_group": "T2" }
cs8_fixed_train_01852
train
T2
v3
Schema: schedules (alias: schd)(name, amount, salary, level) budgets(id, date, status, name) Task: Retrieve amount from schedules with salary above the SUM(salary) of budgets rows sharing the same level. SQL:
SELECT amount FROM schedules AS schd WHERE salary > ( SELECT SUM(salary) FROM budgets AS budg WHERE budg.level = schd.level );
{ "outer_table": "schedules", "inner_table": "budgets", "outer_alias": "schd", "inner_alias": "budg", "proj_col": "amount", "filter_col": "salary", "agg_col": "salary", "agg_fn": "SUM", "join_col": "level", "correlated_ref": "schd.level", "token_group": "T2" }
cs8_fixed_train_01853
train
T2
v1
Schema: customers (alias: cust)(status, amount, type, level) employees(name, type, amount, salary) Task: Retrieve amount from customers whose status is found in employees rows where level matches the outer record. SQL:
SELECT amount FROM customers AS cust WHERE status IN ( SELECT status FROM employees AS emp WHERE emp.level = cust.level );
{ "outer_table": "customers", "inner_table": "employees", "outer_alias": "cust", "inner_alias": "emp", "proj_col": "amount", "filter_col": "status", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_fixed_train_01854
train
T1
v1
Schema: staff (alias: empl)(amount, salary, status, date) departments(id, value, level, salary) Task: Retrieve code from staff whose code is found in departments rows where id matches the outer record. SQL:
SELECT code FROM staff AS empl WHERE code IN ( SELECT code FROM departments AS dept WHERE dept.id = empl.id );
{ "outer_table": "staff", "inner_table": "departments", "outer_alias": "empl", "inner_alias": "dept", "proj_col": "code", "filter_col": "code", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_fixed_train_01855
train
T2
v3
Schema: orders (alias: ord)(salary, level, name, type) warehouses(code, type, salary, date) Task: Find value from orders where salary exceeds the average salary from warehouses for the same type. SQL:
SELECT value FROM orders AS ord WHERE salary > ( SELECT MAX(salary) FROM warehouses AS whs WHERE whs.type = ord.type );
{ "outer_table": "orders", "inner_table": "warehouses", "outer_alias": "ord", "inner_alias": "whs", "proj_col": "value", "filter_col": "salary", "agg_col": "salary", "agg_fn": "MAX", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_fixed_train_01856
train
T1
v1
Schema: staff (alias: empl)(value, level, amount, type) warehouses(type, date, amount, name) Task: Select salary from staff where status exists in warehouses for the same level. SQL:
SELECT salary FROM staff AS empl WHERE status IN ( SELECT status FROM warehouses AS whs WHERE whs.level = empl.level );
{ "outer_table": "staff", "inner_table": "warehouses", "outer_alias": "empl", "inner_alias": "whs", "proj_col": "salary", "filter_col": "status", "join_col": "level", "correlated_ref": "empl.level", "token_group": "T2" }
cs8_fixed_train_01857
train
T2
v1
Schema: schedules (alias: schd)(value, amount, code, name) items(salary, date, code, id) Task: Retrieve id from schedules whose type is found in items rows where id matches the outer record. SQL:
SELECT id FROM schedules AS schd WHERE type IN ( SELECT type FROM items AS lne WHERE lne.id = schd.id );
{ "outer_table": "schedules", "inner_table": "items", "outer_alias": "schd", "inner_alias": "lne", "proj_col": "id", "filter_col": "type", "join_col": "id", "correlated_ref": "schd.id", "token_group": "T2" }
cs8_fixed_train_01858
train
T2
v2
Schema: categories (alias: catg)(amount, value, code, level) services(id, amount, type, salary) Task: Retrieve amount from categories that have at least one corresponding entry in services sharing the same status. SQL:
SELECT amount FROM categories AS catg WHERE EXISTS ( SELECT 1 FROM services AS srvc WHERE srvc.status = catg.status );
{ "outer_table": "categories", "inner_table": "services", "outer_alias": "catg", "inner_alias": "srvc", "proj_col": "amount", "join_col": "status", "correlated_ref": "catg.status", "token_group": "T2" }
cs8_fixed_train_01859
train
T2
v1
Schema: invoices (alias: inv)(id, name, status, amount) items(level, value, date, type) Task: Retrieve name from invoices whose code is found in items rows where id matches the outer record. SQL:
SELECT name FROM invoices AS inv WHERE code IN ( SELECT code FROM items AS lne WHERE lne.id = inv.id );
{ "outer_table": "invoices", "inner_table": "items", "outer_alias": "inv", "inner_alias": "lne", "proj_col": "name", "filter_col": "code", "join_col": "id", "correlated_ref": "inv.id", "token_group": "T1" }
cs8_fixed_train_01860
train
T1
v1
Schema: regions (alias: rgn)(name, level, code, status) products(salary, status, level, value) Task: Retrieve salary from regions whose status is found in products rows where level matches the outer record. SQL:
SELECT salary FROM regions AS rgn WHERE status IN ( SELECT status FROM products AS prod WHERE prod.level = rgn.level );
{ "outer_table": "regions", "inner_table": "products", "outer_alias": "rgn", "inner_alias": "prod", "proj_col": "salary", "filter_col": "status", "join_col": "level", "correlated_ref": "rgn.level", "token_group": "T2" }
cs8_fixed_train_01861
train
T2
v1
Schema: customers (alias: cust)(value, code, name, date) sales(value, level, id, salary) Task: Find id from customers where type appears in sales entries with matching status. SQL:
SELECT id FROM customers AS cust WHERE type IN ( SELECT type FROM sales AS sale WHERE sale.status = cust.status );
{ "outer_table": "customers", "inner_table": "sales", "outer_alias": "cust", "inner_alias": "sale", "proj_col": "id", "filter_col": "type", "join_col": "status", "correlated_ref": "cust.status", "token_group": "T1" }
cs8_fixed_train_01862
train
T1
v1
Schema: orders (alias: ord)(value, salary, status, type) shipments(salary, amount, id, status) Task: Retrieve value from orders whose id is found in shipments rows where code matches the outer record. SQL:
SELECT value FROM orders AS ord WHERE id IN ( SELECT id FROM shipments AS shp WHERE shp.code = ord.code );
{ "outer_table": "orders", "inner_table": "shipments", "outer_alias": "ord", "inner_alias": "shp", "proj_col": "value", "filter_col": "id", "join_col": "code", "correlated_ref": "ord.code", "token_group": "T1" }
cs8_fixed_train_01863
train
T1
v1
Schema: products (alias: prod)(code, name, value, type) departments(value, amount, salary, level) Task: Find name from products where code appears in departments entries with matching status. SQL:
SELECT name FROM products AS prod WHERE code IN ( SELECT code FROM departments AS dept WHERE dept.status = prod.status );
{ "outer_table": "products", "inner_table": "departments", "outer_alias": "prod", "inner_alias": "dept", "proj_col": "name", "filter_col": "code", "join_col": "status", "correlated_ref": "prod.status", "token_group": "T1" }
cs8_fixed_train_01864
train
T1
v3
Schema: regions (alias: rgn)(amount, level, salary, name) requests(level, value, amount, code) Task: Retrieve salary from regions with salary above the SUM(value) of requests rows sharing the same code. SQL:
SELECT salary FROM regions AS rgn WHERE salary > ( SELECT SUM(value) FROM requests AS ordr WHERE ordr.code = rgn.code );
{ "outer_table": "regions", "inner_table": "requests", "outer_alias": "rgn", "inner_alias": "ordr", "proj_col": "salary", "filter_col": "salary", "agg_col": "value", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_fixed_train_01865
train
T2
v1
Schema: items (alias: lne)(amount, date, level, code) invoices(type, code, value, name) Task: Retrieve amount from items whose id is found in invoices rows where level matches the outer record. SQL:
SELECT amount FROM items AS lne WHERE id IN ( SELECT id FROM invoices AS inv WHERE inv.level = lne.level );
{ "outer_table": "items", "inner_table": "invoices", "outer_alias": "lne", "inner_alias": "inv", "proj_col": "amount", "filter_col": "id", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_fixed_train_01866
train
T2
v1
Schema: orders (alias: ord)(amount, salary, type, code) regions(name, value, salary, status) Task: Select value from orders where code exists in regions for the same id. SQL:
SELECT value FROM orders AS ord WHERE code IN ( SELECT code FROM regions AS rgn WHERE rgn.id = ord.id );
{ "outer_table": "orders", "inner_table": "regions", "outer_alias": "ord", "inner_alias": "rgn", "proj_col": "value", "filter_col": "code", "join_col": "id", "correlated_ref": "ord.id", "token_group": "T1" }
cs8_fixed_train_01867
train
T1
v2
Schema: shipments (alias: shp)(code, level, value, id) requests(type, status, date, code) Task: Retrieve salary from shipments that have at least one corresponding entry in requests sharing the same id. SQL:
SELECT salary FROM shipments AS shp WHERE EXISTS ( SELECT 1 FROM requests AS ordr WHERE ordr.id = shp.id );
{ "outer_table": "shipments", "inner_table": "requests", "outer_alias": "shp", "inner_alias": "ordr", "proj_col": "salary", "join_col": "id", "correlated_ref": "shp.id", "token_group": "T2" }
cs8_fixed_train_01868
train
T2
v2
Schema: accounts (alias: acct)(name, type, amount, id) sales(status, salary, value, date) Task: Retrieve code from accounts that have at least one corresponding entry in sales sharing the same type. SQL:
SELECT code FROM accounts AS acct WHERE EXISTS ( SELECT 1 FROM sales AS sale WHERE sale.type = acct.type );
{ "outer_table": "accounts", "inner_table": "sales", "outer_alias": "acct", "inner_alias": "sale", "proj_col": "code", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_fixed_train_01869
train
T1
v3
Schema: shipments (alias: shp)(id, level, type, value) staff(date, code, id, status) Task: Find salary from shipments where value exceeds the average value from staff for the same code. SQL:
SELECT salary FROM shipments AS shp WHERE value > ( SELECT AVG(value) FROM staff AS empl WHERE empl.code = shp.code );
{ "outer_table": "shipments", "inner_table": "staff", "outer_alias": "shp", "inner_alias": "empl", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "shp.code", "token_group": "T2" }
cs8_fixed_train_01870
train
T2
v1
Schema: staff (alias: empl)(type, name, level, amount) managers(status, id, type, amount) Task: Select amount from staff where level exists in managers for the same code. SQL:
SELECT amount FROM staff AS empl WHERE level IN ( SELECT level FROM managers AS mgr WHERE mgr.code = empl.code );
{ "outer_table": "staff", "inner_table": "managers", "outer_alias": "empl", "inner_alias": "mgr", "proj_col": "amount", "filter_col": "level", "join_col": "code", "correlated_ref": "empl.code", "token_group": "T2" }
cs8_fixed_train_01871
train
T2
v1
Schema: shipments (alias: shp)(code, status, date, type) departments(type, value, amount, level) Task: Select code from shipments where code exists in departments for the same type. SQL:
SELECT code FROM shipments AS shp WHERE code IN ( SELECT code FROM departments AS dept WHERE dept.type = shp.type );
{ "outer_table": "shipments", "inner_table": "departments", "outer_alias": "shp", "inner_alias": "dept", "proj_col": "code", "filter_col": "code", "join_col": "type", "correlated_ref": "shp.type", "token_group": "T2" }
cs8_fixed_train_01872
train
T2
v3
Schema: sales (alias: sale)(value, type, status, date) customers(code, level, value, date) Task: Retrieve name from sales with amount above the SUM(amount) of customers rows sharing the same status. SQL:
SELECT name FROM sales AS sale WHERE amount > ( SELECT SUM(amount) FROM customers AS cust WHERE cust.status = sale.status );
{ "outer_table": "sales", "inner_table": "customers", "outer_alias": "sale", "inner_alias": "cust", "proj_col": "name", "filter_col": "amount", "agg_col": "amount", "agg_fn": "SUM", "join_col": "status", "correlated_ref": "sale.status", "token_group": "T1" }
cs8_fixed_train_01873
train
T1
v2
Schema: customers (alias: cust)(value, salary, level, type) departments(type, status, code, amount) Task: Find name from customers where a matching record exists in departments with the same status. SQL:
SELECT name FROM customers AS cust WHERE EXISTS ( SELECT 1 FROM departments AS dept WHERE dept.status = cust.status );
{ "outer_table": "customers", "inner_table": "departments", "outer_alias": "cust", "inner_alias": "dept", "proj_col": "name", "join_col": "status", "correlated_ref": "cust.status", "token_group": "T1" }
cs8_fixed_train_01874
train
T1
v2
Schema: managers (alias: mgr)(salary, name, id, level) orders(status, amount, code, type) Task: Retrieve id from managers that have at least one corresponding entry in orders sharing the same type. SQL:
SELECT id FROM managers AS mgr WHERE EXISTS ( SELECT 1 FROM orders AS ord WHERE ord.type = mgr.type );
{ "outer_table": "managers", "inner_table": "orders", "outer_alias": "mgr", "inner_alias": "ord", "proj_col": "id", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_fixed_train_01875
train
T1
v1
Schema: regions (alias: rgn)(code, level, name, type) orders(name, value, code, type) Task: Select salary from regions where type exists in orders for the same id. SQL:
SELECT salary FROM regions AS rgn WHERE type IN ( SELECT type FROM orders AS ord WHERE ord.id = rgn.id );
{ "outer_table": "regions", "inner_table": "orders", "outer_alias": "rgn", "inner_alias": "ord", "proj_col": "salary", "filter_col": "type", "join_col": "id", "correlated_ref": "rgn.id", "token_group": "T2" }
cs8_fixed_train_01876
train
T2
v2
Schema: customers (alias: cust)(id, code, type, name) shipments(id, level, salary, code) Task: Retrieve name from customers that have at least one corresponding entry in shipments sharing the same id. SQL:
SELECT name FROM customers AS cust WHERE EXISTS ( SELECT 1 FROM shipments AS shp WHERE shp.id = cust.id );
{ "outer_table": "customers", "inner_table": "shipments", "outer_alias": "cust", "inner_alias": "shp", "proj_col": "name", "join_col": "id", "correlated_ref": "cust.id", "token_group": "T1" }
cs8_fixed_train_01877
train
T1
v1
Schema: items (alias: lne)(type, name, date, status) invoices(name, id, type, code) Task: Select value from items where status exists in invoices for the same status. SQL:
SELECT value FROM items AS lne WHERE status IN ( SELECT status FROM invoices AS inv WHERE inv.status = lne.status );
{ "outer_table": "items", "inner_table": "invoices", "outer_alias": "lne", "inner_alias": "inv", "proj_col": "value", "filter_col": "status", "join_col": "status", "correlated_ref": "lne.status", "token_group": "T2" }
cs8_fixed_train_01878
train
T2
v3
Schema: warehouses (alias: whs)(value, id, salary, name) requests(level, status, name, salary) Task: Retrieve value from warehouses with value above the SUM(amount) of requests rows sharing the same status. SQL:
SELECT value FROM warehouses AS whs WHERE value > ( SELECT SUM(amount) FROM requests AS ordr WHERE ordr.status = whs.status );
{ "outer_table": "warehouses", "inner_table": "requests", "outer_alias": "whs", "inner_alias": "ordr", "proj_col": "value", "filter_col": "value", "agg_col": "amount", "agg_fn": "SUM", "join_col": "status", "correlated_ref": "whs.status", "token_group": "T2" }
cs8_fixed_train_01879
train
T2
v2
Schema: items (alias: lne)(level, amount, id, name) shipments(amount, name, status, code) Task: Find value from items where a matching record exists in shipments with the same code. SQL:
SELECT value FROM items AS lne WHERE EXISTS ( SELECT 1 FROM shipments AS shp WHERE shp.code = lne.code );
{ "outer_table": "items", "inner_table": "shipments", "outer_alias": "lne", "inner_alias": "shp", "proj_col": "value", "join_col": "code", "correlated_ref": "lne.code", "token_group": "T2" }
cs8_fixed_train_01880
train
T2
v3
Schema: products (alias: prod)(status, value, level, date) departments(id, status, name, level) Task: Find value from products where amount exceeds the average value from departments for the same id. SQL:
SELECT value FROM products AS prod WHERE amount > ( SELECT COUNT(value) FROM departments AS dept WHERE dept.id = prod.id );
{ "outer_table": "products", "inner_table": "departments", "outer_alias": "prod", "inner_alias": "dept", "proj_col": "value", "filter_col": "amount", "agg_col": "value", "agg_fn": "COUNT", "join_col": "id", "correlated_ref": "prod.id", "token_group": "T1" }
cs8_fixed_train_01881
train
T1
v1
Schema: items (alias: lne)(value, name, id, amount) orders(salary, code, date, id) Task: Retrieve salary from items whose code is found in orders rows where id matches the outer record. SQL:
SELECT salary FROM items AS lne WHERE code IN ( SELECT code FROM orders AS ord WHERE ord.id = lne.id );
{ "outer_table": "items", "inner_table": "orders", "outer_alias": "lne", "inner_alias": "ord", "proj_col": "salary", "filter_col": "code", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_fixed_train_01882
train
T2
v3
Schema: services (alias: srvc)(value, id, status, type) staff(salary, level, amount, code) Task: Retrieve code from services with amount above the SUM(salary) of staff rows sharing the same level. SQL:
SELECT code FROM services AS srvc WHERE amount > ( SELECT SUM(salary) FROM staff AS empl WHERE empl.level = srvc.level );
{ "outer_table": "services", "inner_table": "staff", "outer_alias": "srvc", "inner_alias": "empl", "proj_col": "code", "filter_col": "amount", "agg_col": "salary", "agg_fn": "SUM", "join_col": "level", "correlated_ref": "srvc.level", "token_group": "T2" }
cs8_fixed_train_01883
train
T2
v2
Schema: shipments (alias: shp)(level, type, value, date) orders(level, amount, type, value) Task: Retrieve id from shipments that have at least one corresponding entry in orders sharing the same code. SQL:
SELECT id FROM shipments AS shp WHERE EXISTS ( SELECT 1 FROM orders AS ord WHERE ord.code = shp.code );
{ "outer_table": "shipments", "inner_table": "orders", "outer_alias": "shp", "inner_alias": "ord", "proj_col": "id", "join_col": "code", "correlated_ref": "shp.code", "token_group": "T2" }
cs8_fixed_train_01884
train
T2
v1
Schema: customers (alias: cust)(value, level, id, amount) invoices(level, code, name, amount) Task: Select id from customers where type exists in invoices for the same id. SQL:
SELECT id FROM customers AS cust WHERE type IN ( SELECT type FROM invoices AS inv WHERE inv.id = cust.id );
{ "outer_table": "customers", "inner_table": "invoices", "outer_alias": "cust", "inner_alias": "inv", "proj_col": "id", "filter_col": "type", "join_col": "id", "correlated_ref": "cust.id", "token_group": "T1" }
cs8_fixed_train_01885
train
T1
v1
Schema: staff (alias: empl)(level, id, status, salary) regions(date, name, type, id) Task: Retrieve salary from staff whose type is found in regions rows where id matches the outer record. SQL:
SELECT salary FROM staff AS empl WHERE type IN ( SELECT type FROM regions AS rgn WHERE rgn.id = empl.id );
{ "outer_table": "staff", "inner_table": "regions", "outer_alias": "empl", "inner_alias": "rgn", "proj_col": "salary", "filter_col": "type", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_fixed_train_01886
train
T2
v1
Schema: items (alias: lne)(level, name, code, date) products(amount, status, id, date) Task: Find id from items where status appears in products entries with matching id. SQL:
SELECT id FROM items AS lne WHERE status IN ( SELECT status FROM products AS prod WHERE prod.id = lne.id );
{ "outer_table": "items", "inner_table": "products", "outer_alias": "lne", "inner_alias": "prod", "proj_col": "id", "filter_col": "status", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_fixed_train_01887
train
T2
v3
Schema: items (alias: lne)(code, status, type, id) sales(type, salary, date, code) Task: Retrieve name from items with salary above the AVG(salary) of sales rows sharing the same status. SQL:
SELECT name FROM items AS lne WHERE salary > ( SELECT AVG(salary) FROM sales AS sale WHERE sale.status = lne.status );
{ "outer_table": "items", "inner_table": "sales", "outer_alias": "lne", "inner_alias": "sale", "proj_col": "name", "filter_col": "salary", "agg_col": "salary", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "lne.status", "token_group": "T2" }
cs8_fixed_train_01888
train
T2
v1
Schema: customers (alias: cust)(type, code, amount, status) staff(type, level, code, status) Task: Find amount from customers where level appears in staff entries with matching id. SQL:
SELECT amount FROM customers AS cust WHERE level IN ( SELECT level FROM staff AS empl WHERE empl.id = cust.id );
{ "outer_table": "customers", "inner_table": "staff", "outer_alias": "cust", "inner_alias": "empl", "proj_col": "amount", "filter_col": "level", "join_col": "id", "correlated_ref": "cust.id", "token_group": "T1" }
cs8_fixed_train_01889
train
T1
v3
Schema: categories (alias: catg)(id, type, level, amount) employees(name, status, date, type) Task: Retrieve salary from categories with value above the COUNT(amount) of employees rows sharing the same code. SQL:
SELECT salary FROM categories AS catg WHERE value > ( SELECT COUNT(amount) FROM employees AS emp WHERE emp.code = catg.code );
{ "outer_table": "categories", "inner_table": "employees", "outer_alias": "catg", "inner_alias": "emp", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "code", "correlated_ref": "catg.code", "token_group": "T2" }
cs8_fixed_train_01890
train
T2
v3
Schema: staff (alias: empl)(amount, code, status, id) managers(status, amount, salary, code) Task: Retrieve salary from staff with salary above the MIN(salary) of managers rows sharing the same level. SQL:
SELECT salary FROM staff AS empl WHERE salary > ( SELECT MIN(salary) FROM managers AS mgr WHERE mgr.level = empl.level );
{ "outer_table": "staff", "inner_table": "managers", "outer_alias": "empl", "inner_alias": "mgr", "proj_col": "salary", "filter_col": "salary", "agg_col": "salary", "agg_fn": "MIN", "join_col": "level", "correlated_ref": "empl.level", "token_group": "T2" }
cs8_fixed_train_01891
train
T2
v3
Schema: sales (alias: sale)(code, salary, type, level) managers(amount, salary, type, value) Task: Find salary from sales where value exceeds the average amount from managers for the same level. SQL:
SELECT salary FROM sales AS sale WHERE value > ( SELECT MAX(amount) FROM managers AS mgr WHERE mgr.level = sale.level );
{ "outer_table": "sales", "inner_table": "managers", "outer_alias": "sale", "inner_alias": "mgr", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "MAX", "join_col": "level", "correlated_ref": "sale.level", "token_group": "T1" }
cs8_fixed_train_01892
train
T1
v3
Schema: products (alias: prod)(name, code, id, date) items(level, salary, code, status) Task: Find amount from products where value exceeds the average value from items for the same code. SQL:
SELECT amount FROM products AS prod WHERE value > ( SELECT MIN(value) FROM items AS lne WHERE lne.code = prod.code );
{ "outer_table": "products", "inner_table": "items", "outer_alias": "prod", "inner_alias": "lne", "proj_col": "amount", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "code", "correlated_ref": "prod.code", "token_group": "T1" }
cs8_fixed_train_01893
train
T1
v2
Schema: staff (alias: empl)(amount, code, name, id) services(name, code, salary, date) Task: Find amount from staff where a matching record exists in services with the same code. SQL:
SELECT amount FROM staff AS empl WHERE EXISTS ( SELECT 1 FROM services AS srvc WHERE srvc.code = empl.code );
{ "outer_table": "staff", "inner_table": "services", "outer_alias": "empl", "inner_alias": "srvc", "proj_col": "amount", "join_col": "code", "correlated_ref": "empl.code", "token_group": "T2" }
cs8_fixed_train_01894
train
T2
v1
Schema: categories (alias: catg)(id, salary, value, status) employees(id, status, value, name) Task: Retrieve name from categories whose code is found in employees rows where code matches the outer record. SQL:
SELECT name FROM categories AS catg WHERE code IN ( SELECT code FROM employees AS emp WHERE emp.code = catg.code );
{ "outer_table": "categories", "inner_table": "employees", "outer_alias": "catg", "inner_alias": "emp", "proj_col": "name", "filter_col": "code", "join_col": "code", "correlated_ref": "catg.code", "token_group": "T2" }
cs8_fixed_train_01895
train
T2
v2
Schema: accounts (alias: acct)(date, type, code, level) categories(value, status, date, code) Task: Retrieve code from accounts that have at least one corresponding entry in categories sharing the same status. SQL:
SELECT code FROM accounts AS acct WHERE EXISTS ( SELECT 1 FROM categories AS catg WHERE catg.status = acct.status );
{ "outer_table": "accounts", "inner_table": "categories", "outer_alias": "acct", "inner_alias": "catg", "proj_col": "code", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_fixed_train_01896
train
T1
v2
Schema: employees (alias: emp)(status, level, date, value) transactions(type, amount, level, date) Task: Retrieve salary from employees that have at least one corresponding entry in transactions sharing the same level. SQL:
SELECT salary FROM employees AS emp WHERE EXISTS ( SELECT 1 FROM transactions AS txn WHERE txn.level = emp.level );
{ "outer_table": "employees", "inner_table": "transactions", "outer_alias": "emp", "inner_alias": "txn", "proj_col": "salary", "join_col": "level", "correlated_ref": "emp.level", "token_group": "T1" }
cs8_fixed_train_01897
train
T1
v1
Schema: warehouses (alias: whs)(code, value, status, type) staff(value, amount, date, status) Task: Find amount from warehouses where code appears in staff entries with matching id. SQL:
SELECT amount FROM warehouses AS whs WHERE code IN ( SELECT code FROM staff AS empl WHERE empl.id = whs.id );
{ "outer_table": "warehouses", "inner_table": "staff", "outer_alias": "whs", "inner_alias": "empl", "proj_col": "amount", "filter_col": "code", "join_col": "id", "correlated_ref": "whs.id", "token_group": "T2" }
cs8_fixed_train_01898
train
T2
v1
Schema: employees (alias: emp)(date, amount, salary, id) sales(status, amount, value, type) Task: Retrieve value from employees whose code is found in sales rows where level matches the outer record. SQL:
SELECT value FROM employees AS emp WHERE code IN ( SELECT code FROM sales AS sale WHERE sale.level = emp.level );
{ "outer_table": "employees", "inner_table": "sales", "outer_alias": "emp", "inner_alias": "sale", "proj_col": "value", "filter_col": "code", "join_col": "level", "correlated_ref": "emp.level", "token_group": "T1" }
cs8_fixed_train_01899
train
T1