Dataset Viewer
Auto-converted to Parquet Duplicate
variant
stringclasses
3 values
prompt
stringlengths
165
235
sql
stringlengths
104
143
metadata
unknown
id
stringlengths
15
15
split
stringclasses
1 value
token_group
stringclasses
2 values
v1
Schema: orders (alias: cust)(type, value, salary, status) projects(level, id, status, name) Task: Find amount from orders where status appears in projects entries with matching code. SQL:
SELECT amount FROM orders AS cust WHERE status IN ( SELECT status FROM projects AS schd WHERE schd.code = cust.code );
{ "outer_table": "orders", "inner_table": "projects", "outer_alias": "cust", "inner_alias": "schd", "proj_col": "amount", "filter_col": "status", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_train_00000
train
T1
v2
Schema: transactions (alias: dept)(status, date, level, amount) accounts(date, amount, level, value) Task: Find amount from transactions where a matching record exists in accounts with the same level. SQL:
SELECT amount FROM transactions AS dept WHERE EXISTS ( SELECT 1 FROM accounts AS mgr WHERE mgr.level = dept.level );
{ "outer_table": "transactions", "inner_table": "accounts", "outer_alias": "dept", "inner_alias": "mgr", "proj_col": "amount", "join_col": "level", "correlated_ref": "dept.level", "token_group": "T1" }
cs8_train_00001
train
T1
v3
Schema: orders (alias: whs)(name, code, id, level) shipments(name, status, date, type) Task: Find id from orders where salary exceeds the average salary from shipments for the same type. SQL:
SELECT id FROM orders AS whs WHERE salary > ( SELECT AVG(salary) FROM shipments AS ord WHERE ord.type = whs.type );
{ "outer_table": "orders", "inner_table": "shipments", "outer_alias": "whs", "inner_alias": "ord", "proj_col": "id", "filter_col": "salary", "agg_col": "salary", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00002
train
T2
v2
Schema: invoices (alias: emp)(date, code, amount, value) transactions(level, type, value, salary) Task: Find salary from invoices where a matching record exists in transactions with the same code. SQL:
SELECT salary FROM invoices AS emp WHERE EXISTS ( SELECT 1 FROM transactions AS whs WHERE whs.code = emp.code );
{ "outer_table": "invoices", "inner_table": "transactions", "outer_alias": "emp", "inner_alias": "whs", "proj_col": "salary", "join_col": "code", "correlated_ref": "emp.code", "token_group": "T1" }
cs8_train_00003
train
T1
v1
Schema: orders (alias: dept)(value, level, salary, type) products(status, level, type, salary) Task: Find code from orders where type appears in products entries with matching type. SQL:
SELECT code FROM orders AS dept WHERE type IN ( SELECT type FROM products AS shp WHERE shp.type = dept.type );
{ "outer_table": "orders", "inner_table": "products", "outer_alias": "dept", "inner_alias": "shp", "proj_col": "code", "filter_col": "type", "join_col": "type", "correlated_ref": "dept.type", "token_group": "T1" }
cs8_train_00004
train
T1
v3
Schema: warehouses (alias: whs)(date, salary, type, value) accounts(value, salary, level, amount) Task: Find value from warehouses where salary exceeds the average amount from accounts for the same level. SQL:
SELECT value FROM warehouses AS whs WHERE salary > ( SELECT SUM(amount) FROM accounts AS ord WHERE ord.level = whs.level );
{ "outer_table": "warehouses", "inner_table": "accounts", "outer_alias": "whs", "inner_alias": "ord", "proj_col": "value", "filter_col": "salary", "agg_col": "amount", "agg_fn": "SUM", "join_col": "level", "correlated_ref": "whs.level", "token_group": "T2" }
cs8_train_00005
train
T2
v1
Schema: transactions (alias: rgn)(code, level, id, type) products(amount, value, type, status) Task: Find code from transactions where code appears in products entries with matching code. SQL:
SELECT code FROM transactions AS rgn WHERE code IN ( SELECT code FROM products AS emp WHERE emp.code = rgn.code );
{ "outer_table": "transactions", "inner_table": "products", "outer_alias": "rgn", "inner_alias": "emp", "proj_col": "code", "filter_col": "code", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00006
train
T2
v2
Schema: customers (alias: sale)(amount, type, code, name) projects(date, status, id, name) Task: Find code from customers where a matching record exists in projects with the same type. SQL:
SELECT code FROM customers AS sale WHERE EXISTS ( SELECT 1 FROM projects AS empl WHERE empl.type = sale.type );
{ "outer_table": "customers", "inner_table": "projects", "outer_alias": "sale", "inner_alias": "empl", "proj_col": "code", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00007
train
T1
v3
Schema: employees (alias: lne)(amount, code, level, id) shipments(id, date, type, level) Task: Find name from employees where value exceeds the average salary from shipments for the same id. SQL:
SELECT name FROM employees AS lne WHERE value > ( SELECT MIN(salary) FROM shipments AS prod WHERE prod.id = lne.id );
{ "outer_table": "employees", "inner_table": "shipments", "outer_alias": "lne", "inner_alias": "prod", "proj_col": "name", "filter_col": "value", "agg_col": "salary", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_train_00008
train
T2
v1
Schema: departments (alias: mgr)(name, amount, id, code) branches(id, salary, level, status) Task: Find code from departments where id appears in branches entries with matching type. SQL:
SELECT code FROM departments AS mgr WHERE id IN ( SELECT id FROM branches AS txn WHERE txn.type = mgr.type );
{ "outer_table": "departments", "inner_table": "branches", "outer_alias": "mgr", "inner_alias": "txn", "proj_col": "code", "filter_col": "id", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00009
train
T1
v1
Schema: departments (alias: txn)(status, name, id, value) regions(type, value, code, date) Task: Retrieve amount from departments whose id is found in regions rows where id matches the outer record. SQL:
SELECT amount FROM departments AS txn WHERE id IN ( SELECT id FROM regions AS schd WHERE schd.id = txn.id );
{ "outer_table": "departments", "inner_table": "regions", "outer_alias": "txn", "inner_alias": "schd", "proj_col": "amount", "filter_col": "id", "join_col": "id", "correlated_ref": "txn.id", "token_group": "T1" }
cs8_train_00010
train
T1
v1
Schema: invoices (alias: emp)(id, level, status, salary) accounts(code, name, salary, status) Task: Select name from invoices where type exists in accounts for the same status. SQL:
SELECT name FROM invoices AS emp WHERE type IN ( SELECT type FROM accounts AS ordr WHERE ordr.status = emp.status );
{ "outer_table": "invoices", "inner_table": "accounts", "outer_alias": "emp", "inner_alias": "ordr", "proj_col": "name", "filter_col": "type", "join_col": "status", "correlated_ref": "emp.status", "token_group": "T1" }
cs8_train_00011
train
T1
v2
Schema: customers (alias: srvc)(id, amount, date, name) categories(value, salary, id, status) Task: Find amount from customers where a matching record exists in categories with the same type. SQL:
SELECT amount FROM customers AS srvc WHERE EXISTS ( SELECT 1 FROM categories AS acct WHERE acct.type = srvc.type );
{ "outer_table": "customers", "inner_table": "categories", "outer_alias": "srvc", "inner_alias": "acct", "proj_col": "amount", "join_col": "type", "correlated_ref": "srvc.type", "token_group": "T2" }
cs8_train_00012
train
T2
v2
Schema: departments (alias: schd)(date, id, amount, status) transactions(value, status, name, type) Task: Retrieve value from departments that have at least one corresponding entry in transactions sharing the same code. SQL:
SELECT value FROM departments AS schd WHERE EXISTS ( SELECT 1 FROM transactions AS prod WHERE prod.code = schd.code );
{ "outer_table": "departments", "inner_table": "transactions", "outer_alias": "schd", "inner_alias": "prod", "proj_col": "value", "join_col": "code", "correlated_ref": "schd.code", "token_group": "T2" }
cs8_train_00013
train
T2
v3
Schema: categories (alias: ord)(type, code, level, date) projects(status, id, code, name) Task: Find name from categories where salary exceeds the average salary from projects for the same status. SQL:
SELECT name FROM categories AS ord WHERE salary > ( SELECT AVG(salary) FROM projects AS cust WHERE cust.status = ord.status );
{ "outer_table": "categories", "inner_table": "projects", "outer_alias": "ord", "inner_alias": "cust", "proj_col": "name", "filter_col": "salary", "agg_col": "salary", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "ord.status", "token_group": "T1" }
cs8_train_00014
train
T1
v3
Schema: invoices (alias: txn)(code, level, id, amount) shipments(value, amount, code, salary) Task: Retrieve code from invoices with amount above the MAX(salary) of shipments rows sharing the same id. SQL:
SELECT code FROM invoices AS txn WHERE amount > ( SELECT MAX(salary) FROM shipments AS shp WHERE shp.id = txn.id );
{ "outer_table": "invoices", "inner_table": "shipments", "outer_alias": "txn", "inner_alias": "shp", "proj_col": "code", "filter_col": "amount", "agg_col": "salary", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "txn.id", "token_group": "T1" }
cs8_train_00015
train
T1
v1
Schema: transactions (alias: sale)(value, code, salary, date) projects(code, amount, status, type) Task: Select code from transactions where code exists in projects for the same status. SQL:
SELECT code FROM transactions AS sale WHERE code IN ( SELECT code FROM projects AS cust WHERE cust.status = sale.status );
{ "outer_table": "transactions", "inner_table": "projects", "outer_alias": "sale", "inner_alias": "cust", "proj_col": "code", "filter_col": "code", "join_col": "status", "correlated_ref": "sale.status", "token_group": "T1" }
cs8_train_00016
train
T1
v2
Schema: warehouses (alias: inv)(id, type, value, code) projects(type, status, date, name) Task: Retrieve value from warehouses that have at least one corresponding entry in projects sharing the same code. SQL:
SELECT value FROM warehouses AS inv WHERE EXISTS ( SELECT 1 FROM projects AS txn WHERE txn.code = inv.code );
{ "outer_table": "warehouses", "inner_table": "projects", "outer_alias": "inv", "inner_alias": "txn", "proj_col": "value", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00017
train
T1
v2
Schema: accounts (alias: rgn)(status, type, salary, value) projects(amount, salary, id, code) Task: Find value from accounts where a matching record exists in projects with the same code. SQL:
SELECT value FROM accounts AS rgn WHERE EXISTS ( SELECT 1 FROM projects AS prod WHERE prod.code = rgn.code );
{ "outer_table": "accounts", "inner_table": "projects", "outer_alias": "rgn", "inner_alias": "prod", "proj_col": "value", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00018
train
T2
v1
Schema: transactions (alias: lne)(code, name, level, amount) categories(code, amount, status, type) Task: Select salary from transactions where type exists in categories for the same type. SQL:
SELECT salary FROM transactions AS lne WHERE type IN ( SELECT type FROM categories AS schd WHERE schd.type = lne.type );
{ "outer_table": "transactions", "inner_table": "categories", "outer_alias": "lne", "inner_alias": "schd", "proj_col": "salary", "filter_col": "type", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_train_00019
train
T2
v2
Schema: products (alias: rgn)(code, salary, name, date) employees(amount, level, id, salary) Task: Retrieve value from products that have at least one corresponding entry in employees sharing the same status. SQL:
SELECT value FROM products AS rgn WHERE EXISTS ( SELECT 1 FROM employees AS lne WHERE lne.status = rgn.status );
{ "outer_table": "products", "inner_table": "employees", "outer_alias": "rgn", "inner_alias": "lne", "proj_col": "value", "join_col": "status", "correlated_ref": "rgn.status", "token_group": "T2" }
cs8_train_00020
train
T2
v2
Schema: regions (alias: sale)(level, name, salary, status) transactions(type, value, status, date) Task: Retrieve amount from regions that have at least one corresponding entry in transactions sharing the same id. SQL:
SELECT amount FROM regions AS sale WHERE EXISTS ( SELECT 1 FROM transactions AS dept WHERE dept.id = sale.id );
{ "outer_table": "regions", "inner_table": "transactions", "outer_alias": "sale", "inner_alias": "dept", "proj_col": "amount", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00021
train
T1
v1
Schema: shipments (alias: ordr)(salary, date, level, amount) warehouses(salary, level, name, value) Task: Select name from shipments where status exists in warehouses for the same type. SQL:
SELECT name FROM shipments AS ordr WHERE status IN ( SELECT status FROM warehouses AS shp WHERE shp.type = ordr.type );
{ "outer_table": "shipments", "inner_table": "warehouses", "outer_alias": "ordr", "inner_alias": "shp", "proj_col": "name", "filter_col": "status", "join_col": "type", "correlated_ref": "ordr.type", "token_group": "T2" }
cs8_train_00022
train
T2
v2
Schema: products (alias: catg)(date, name, amount, status) tasks(status, id, code, date) Task: Find id from products where a matching record exists in tasks with the same status. SQL:
SELECT id FROM products AS catg WHERE EXISTS ( SELECT 1 FROM tasks AS cust WHERE cust.status = catg.status );
{ "outer_table": "products", "inner_table": "tasks", "outer_alias": "catg", "inner_alias": "cust", "proj_col": "id", "join_col": "status", "correlated_ref": "catg.status", "token_group": "T2" }
cs8_train_00023
train
T2
v3
Schema: accounts (alias: lne)(amount, date, name, id) orders(status, name, level, code) Task: Find salary from accounts where value exceeds the average value from orders for the same type. SQL:
SELECT salary FROM accounts AS lne WHERE value > ( SELECT COUNT(value) FROM orders AS inv WHERE inv.type = lne.type );
{ "outer_table": "accounts", "inner_table": "orders", "outer_alias": "lne", "inner_alias": "inv", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "COUNT", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_train_00024
train
T2
v1
Schema: invoices (alias: acct)(id, name, level, code) orders(code, amount, level, salary) Task: Select salary from invoices where code exists in orders for the same status. SQL:
SELECT salary FROM invoices AS acct WHERE code IN ( SELECT code FROM orders AS budg WHERE budg.status = acct.status );
{ "outer_table": "invoices", "inner_table": "orders", "outer_alias": "acct", "inner_alias": "budg", "proj_col": "salary", "filter_col": "code", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_train_00025
train
T1
v1
Schema: suppliers (alias: whs)(salary, value, amount, type) projects(salary, amount, value, level) Task: Select value from suppliers where id exists in projects for the same status. SQL:
SELECT value FROM suppliers AS whs WHERE id IN ( SELECT id FROM projects AS dept WHERE dept.status = whs.status );
{ "outer_table": "suppliers", "inner_table": "projects", "outer_alias": "whs", "inner_alias": "dept", "proj_col": "value", "filter_col": "id", "join_col": "status", "correlated_ref": "whs.status", "token_group": "T2" }
cs8_train_00026
train
T2
v3
Schema: regions (alias: shp)(salary, amount, code, date) accounts(date, code, level, type) Task: Find salary from regions where value exceeds the average value from accounts for the same status. SQL:
SELECT salary FROM regions AS shp WHERE value > ( SELECT MIN(value) FROM accounts AS ord WHERE ord.status = shp.status );
{ "outer_table": "regions", "inner_table": "accounts", "outer_alias": "shp", "inner_alias": "ord", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_train_00027
train
T2
v2
Schema: regions (alias: acct)(amount, value, date, id) suppliers(value, name, id, level) Task: Retrieve name from regions that have at least one corresponding entry in suppliers sharing the same status. SQL:
SELECT name FROM regions AS acct WHERE EXISTS ( SELECT 1 FROM suppliers AS ord WHERE ord.status = acct.status );
{ "outer_table": "regions", "inner_table": "suppliers", "outer_alias": "acct", "inner_alias": "ord", "proj_col": "name", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_train_00028
train
T1
v1
Schema: tasks (alias: budg)(status, salary, id, level) suppliers(level, type, salary, name) Task: Find salary from tasks where status appears in suppliers entries with matching id. SQL:
SELECT salary FROM tasks AS budg WHERE status IN ( SELECT status FROM suppliers AS sale WHERE sale.id = budg.id );
{ "outer_table": "tasks", "inner_table": "suppliers", "outer_alias": "budg", "inner_alias": "sale", "proj_col": "salary", "filter_col": "status", "join_col": "id", "correlated_ref": "budg.id", "token_group": "T2" }
cs8_train_00029
train
T2
v1
Schema: projects (alias: inv)(date, value, type, salary) orders(code, value, date, amount) Task: Retrieve salary from projects whose level is found in orders rows where code matches the outer record. SQL:
SELECT salary FROM projects AS inv WHERE level IN ( SELECT level FROM orders AS emp WHERE emp.code = inv.code );
{ "outer_table": "projects", "inner_table": "orders", "outer_alias": "inv", "inner_alias": "emp", "proj_col": "salary", "filter_col": "level", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00030
train
T1
v3
Schema: shipments (alias: whs)(amount, id, status, value) categories(type, id, salary, value) Task: Find amount from shipments where amount exceeds the average amount from categories for the same status. SQL:
SELECT amount FROM shipments AS whs WHERE amount > ( SELECT COUNT(amount) FROM categories AS schd WHERE schd.status = whs.status );
{ "outer_table": "shipments", "inner_table": "categories", "outer_alias": "whs", "inner_alias": "schd", "proj_col": "amount", "filter_col": "amount", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "whs.status", "token_group": "T2" }
cs8_train_00031
train
T2
v3
Schema: projects (alias: dept)(value, amount, level, salary) branches(code, name, status, value) Task: Retrieve salary from projects with amount above the COUNT(amount) of branches rows sharing the same id. SQL:
SELECT salary FROM projects AS dept WHERE amount > ( SELECT COUNT(amount) FROM branches AS budg WHERE budg.id = dept.id );
{ "outer_table": "projects", "inner_table": "branches", "outer_alias": "dept", "inner_alias": "budg", "proj_col": "salary", "filter_col": "amount", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00032
train
T1
v1
Schema: departments (alias: dept)(name, type, status, salary) shipments(value, type, amount, level) Task: Select id from departments where code exists in shipments for the same code. SQL:
SELECT id FROM departments AS dept WHERE code IN ( SELECT code FROM shipments AS rgn WHERE rgn.code = dept.code );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "dept", "inner_alias": "rgn", "proj_col": "id", "filter_col": "code", "join_col": "code", "correlated_ref": "dept.code", "token_group": "T1" }
cs8_train_00033
train
T1
v3
Schema: branches (alias: srvc)(code, id, date, salary) transactions(type, name, date, code) Task: Find id from branches where salary exceeds the average salary from transactions for the same level. SQL:
SELECT id FROM branches AS srvc WHERE salary > ( SELECT MAX(salary) FROM transactions AS budg WHERE budg.level = srvc.level );
{ "outer_table": "branches", "inner_table": "transactions", "outer_alias": "srvc", "inner_alias": "budg", "proj_col": "id", "filter_col": "salary", "agg_col": "salary", "agg_fn": "MAX", "join_col": "level", "correlated_ref": "srvc.level", "token_group": "T2" }
cs8_train_00034
train
T2
v3
Schema: orders (alias: srvc)(id, amount, name, salary) customers(date, name, id, level) Task: Retrieve amount from orders with value above the MAX(value) of customers rows sharing the same code. SQL:
SELECT amount FROM orders AS srvc WHERE value > ( SELECT MAX(value) FROM customers AS acct WHERE acct.code = srvc.code );
{ "outer_table": "orders", "inner_table": "customers", "outer_alias": "srvc", "inner_alias": "acct", "proj_col": "amount", "filter_col": "value", "agg_col": "value", "agg_fn": "MAX", "join_col": "code", "correlated_ref": "srvc.code", "token_group": "T2" }
cs8_train_00035
train
T2
v1
Schema: transactions (alias: emp)(status, amount, type, level) warehouses(id, level, status, date) Task: Retrieve value from transactions whose status is found in warehouses rows where status matches the outer record. SQL:
SELECT value FROM transactions AS emp WHERE status IN ( SELECT status FROM warehouses AS catg WHERE catg.status = emp.status );
{ "outer_table": "transactions", "inner_table": "warehouses", "outer_alias": "emp", "inner_alias": "catg", "proj_col": "value", "filter_col": "status", "join_col": "status", "correlated_ref": "emp.status", "token_group": "T1" }
cs8_train_00036
train
T1
v3
Schema: accounts (alias: prod)(id, type, level, amount) shipments(salary, value, amount, code) Task: Find amount from accounts where value exceeds the average value from shipments for the same type. SQL:
SELECT amount FROM accounts AS prod WHERE value > ( SELECT AVG(value) FROM shipments AS mgr WHERE mgr.type = prod.type );
{ "outer_table": "accounts", "inner_table": "shipments", "outer_alias": "prod", "inner_alias": "mgr", "proj_col": "amount", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "prod.type", "token_group": "T1" }
cs8_train_00037
train
T1
v3
Schema: shipments (alias: srvc)(status, date, id, salary) accounts(level, date, name, id) Task: Retrieve value from shipments with value above the MIN(value) of accounts rows sharing the same status. SQL:
SELECT value FROM shipments AS srvc WHERE value > ( SELECT MIN(value) FROM accounts AS catg WHERE catg.status = srvc.status );
{ "outer_table": "shipments", "inner_table": "accounts", "outer_alias": "srvc", "inner_alias": "catg", "proj_col": "value", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00038
train
T2
v1
Schema: customers (alias: budg)(status, amount, date, id) tasks(code, name, level, date) Task: Select id from customers where type exists in tasks for the same type. SQL:
SELECT id FROM customers AS budg WHERE type IN ( SELECT type FROM tasks AS empl WHERE empl.type = budg.type );
{ "outer_table": "customers", "inner_table": "tasks", "outer_alias": "budg", "inner_alias": "empl", "proj_col": "id", "filter_col": "type", "join_col": "type", "correlated_ref": "budg.type", "token_group": "T2" }
cs8_train_00039
train
T2
v2
Schema: branches (alias: budg)(value, type, id, level) departments(name, amount, salary, code) Task: Find amount from branches where a matching record exists in departments with the same level. SQL:
SELECT amount FROM branches AS budg WHERE EXISTS ( SELECT 1 FROM departments AS lne WHERE lne.level = budg.level );
{ "outer_table": "branches", "inner_table": "departments", "outer_alias": "budg", "inner_alias": "lne", "proj_col": "amount", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00040
train
T2
v2
Schema: categories (alias: mgr)(id, date, salary, name) regions(type, code, level, name) Task: Retrieve name from categories that have at least one corresponding entry in regions sharing the same type. SQL:
SELECT name FROM categories AS mgr WHERE EXISTS ( SELECT 1 FROM regions AS acct WHERE acct.type = mgr.type );
{ "outer_table": "categories", "inner_table": "regions", "outer_alias": "mgr", "inner_alias": "acct", "proj_col": "name", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00041
train
T1
v2
Schema: products (alias: mgr)(status, value, type, level) accounts(type, salary, value, status) Task: Find salary from products where a matching record exists in accounts with the same status. SQL:
SELECT salary FROM products AS mgr WHERE EXISTS ( SELECT 1 FROM accounts AS txn WHERE txn.status = mgr.status );
{ "outer_table": "products", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "txn", "proj_col": "salary", "join_col": "status", "correlated_ref": "mgr.status", "token_group": "T1" }
cs8_train_00042
train
T1
v2
Schema: customers (alias: rgn)(name, date, id, code) accounts(value, code, level, salary) Task: Retrieve name from customers that have at least one corresponding entry in accounts sharing the same code. SQL:
SELECT name FROM customers AS rgn WHERE EXISTS ( SELECT 1 FROM accounts AS empl WHERE empl.code = rgn.code );
{ "outer_table": "customers", "inner_table": "accounts", "outer_alias": "rgn", "inner_alias": "empl", "proj_col": "name", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00043
train
T2
v3
Schema: regions (alias: lne)(type, salary, amount, name) tasks(name, status, amount, code) Task: Find id from regions where value exceeds the average value from tasks for the same id. SQL:
SELECT id FROM regions AS lne WHERE value > ( SELECT SUM(value) FROM tasks AS sale WHERE sale.id = lne.id );
{ "outer_table": "regions", "inner_table": "tasks", "outer_alias": "lne", "inner_alias": "sale", "proj_col": "id", "filter_col": "value", "agg_col": "value", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_train_00044
train
T2
v1
Schema: warehouses (alias: sale)(value, name, type, status) categories(type, id, salary, date) Task: Retrieve code from warehouses whose id is found in categories rows where id matches the outer record. SQL:
SELECT code FROM warehouses AS sale WHERE id IN ( SELECT id FROM categories AS inv WHERE inv.id = sale.id );
{ "outer_table": "warehouses", "inner_table": "categories", "outer_alias": "sale", "inner_alias": "inv", "proj_col": "code", "filter_col": "id", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00045
train
T1
v2
Schema: accounts (alias: lne)(value, salary, level, status) categories(name, level, amount, salary) Task: Retrieve name from accounts that have at least one corresponding entry in categories sharing the same id. SQL:
SELECT name FROM accounts AS lne WHERE EXISTS ( SELECT 1 FROM categories AS emp WHERE emp.id = lne.id );
{ "outer_table": "accounts", "inner_table": "categories", "outer_alias": "lne", "inner_alias": "emp", "proj_col": "name", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_train_00046
train
T2
v2
Schema: categories (alias: emp)(value, code, amount, status) branches(date, salary, type, level) Task: Retrieve value from categories that have at least one corresponding entry in branches sharing the same status. SQL:
SELECT value FROM categories AS emp WHERE EXISTS ( SELECT 1 FROM branches AS txn WHERE txn.status = emp.status );
{ "outer_table": "categories", "inner_table": "branches", "outer_alias": "emp", "inner_alias": "txn", "proj_col": "value", "join_col": "status", "correlated_ref": "emp.status", "token_group": "T1" }
cs8_train_00047
train
T1
v2
Schema: branches (alias: empl)(code, salary, id, level) orders(code, amount, value, name) Task: Retrieve amount from branches that have at least one corresponding entry in orders sharing the same status. SQL:
SELECT amount FROM branches AS empl WHERE EXISTS ( SELECT 1 FROM orders AS srvc WHERE srvc.status = empl.status );
{ "outer_table": "branches", "inner_table": "orders", "outer_alias": "empl", "inner_alias": "srvc", "proj_col": "amount", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_train_00048
train
T2
v1
Schema: tasks (alias: inv)(level, name, code, status) customers(type, amount, date, value) Task: Select name from tasks where code exists in customers for the same level. SQL:
SELECT name FROM tasks AS inv WHERE code IN ( SELECT code FROM customers AS sale WHERE sale.level = inv.level );
{ "outer_table": "tasks", "inner_table": "customers", "outer_alias": "inv", "inner_alias": "sale", "proj_col": "name", "filter_col": "code", "join_col": "level", "correlated_ref": "inv.level", "token_group": "T1" }
cs8_train_00049
train
T1
v1
Schema: branches (alias: schd)(name, code, id, status) projects(salary, level, name, amount) Task: Retrieve id from branches whose level is found in projects rows where id matches the outer record. SQL:
SELECT id FROM branches AS schd WHERE level IN ( SELECT level FROM projects AS ord WHERE ord.id = schd.id );
{ "outer_table": "branches", "inner_table": "projects", "outer_alias": "schd", "inner_alias": "ord", "proj_col": "id", "filter_col": "level", "join_col": "id", "correlated_ref": "schd.id", "token_group": "T2" }
cs8_train_00050
train
T2
v1
Schema: tasks (alias: acct)(type, salary, amount, id) employees(amount, value, status, salary) Task: Select value from tasks where level exists in employees for the same level. SQL:
SELECT value FROM tasks AS acct WHERE level IN ( SELECT level FROM employees AS rgn WHERE rgn.level = acct.level );
{ "outer_table": "tasks", "inner_table": "employees", "outer_alias": "acct", "inner_alias": "rgn", "proj_col": "value", "filter_col": "level", "join_col": "level", "correlated_ref": "acct.level", "token_group": "T1" }
cs8_train_00051
train
T1
v1
Schema: employees (alias: srvc)(name, amount, date, level) shipments(status, amount, type, name) Task: Retrieve salary from employees whose level is found in shipments rows where level matches the outer record. SQL:
SELECT salary FROM employees AS srvc WHERE level IN ( SELECT level FROM shipments AS acct WHERE acct.level = srvc.level );
{ "outer_table": "employees", "inner_table": "shipments", "outer_alias": "srvc", "inner_alias": "acct", "proj_col": "salary", "filter_col": "level", "join_col": "level", "correlated_ref": "srvc.level", "token_group": "T2" }
cs8_train_00052
train
T2
v1
Schema: customers (alias: prod)(id, level, salary, status) invoices(value, type, name, amount) Task: Select value from customers where status exists in invoices for the same level. SQL:
SELECT value FROM customers AS prod WHERE status IN ( SELECT status FROM invoices AS inv WHERE inv.level = prod.level );
{ "outer_table": "customers", "inner_table": "invoices", "outer_alias": "prod", "inner_alias": "inv", "proj_col": "value", "filter_col": "status", "join_col": "level", "correlated_ref": "prod.level", "token_group": "T1" }
cs8_train_00053
train
T1
v2
Schema: suppliers (alias: ordr)(code, date, status, salary) departments(level, amount, name, type) Task: Find value from suppliers where a matching record exists in departments with the same status. SQL:
SELECT value FROM suppliers AS ordr WHERE EXISTS ( SELECT 1 FROM departments AS shp WHERE shp.status = ordr.status );
{ "outer_table": "suppliers", "inner_table": "departments", "outer_alias": "ordr", "inner_alias": "shp", "proj_col": "value", "join_col": "status", "correlated_ref": "ordr.status", "token_group": "T2" }
cs8_train_00054
train
T2
v1
Schema: accounts (alias: inv)(code, date, level, salary) projects(amount, value, code, level) Task: Select code from accounts where code exists in projects for the same status. SQL:
SELECT code FROM accounts AS inv WHERE code IN ( SELECT code FROM projects AS empl WHERE empl.status = inv.status );
{ "outer_table": "accounts", "inner_table": "projects", "outer_alias": "inv", "inner_alias": "empl", "proj_col": "code", "filter_col": "code", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_train_00055
train
T1
v2
Schema: invoices (alias: catg)(amount, type, level, status) customers(amount, status, level, type) Task: Retrieve id from invoices that have at least one corresponding entry in customers sharing the same code. SQL:
SELECT id FROM invoices AS catg WHERE EXISTS ( SELECT 1 FROM customers AS sale WHERE sale.code = catg.code );
{ "outer_table": "invoices", "inner_table": "customers", "outer_alias": "catg", "inner_alias": "sale", "proj_col": "id", "join_col": "code", "correlated_ref": "catg.code", "token_group": "T2" }
cs8_train_00056
train
T2
v3
Schema: customers (alias: emp)(code, status, date, name) invoices(type, date, amount, salary) Task: Retrieve name from customers with value above the MIN(value) of invoices rows sharing the same id. SQL:
SELECT name FROM customers AS emp WHERE value > ( SELECT MIN(value) FROM invoices AS txn WHERE txn.id = emp.id );
{ "outer_table": "customers", "inner_table": "invoices", "outer_alias": "emp", "inner_alias": "txn", "proj_col": "name", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "emp.id", "token_group": "T1" }
cs8_train_00057
train
T1
v3
Schema: departments (alias: empl)(type, value, id, level) products(amount, type, salary, status) Task: Retrieve value from departments with amount above the MIN(value) of products rows sharing the same status. SQL:
SELECT value FROM departments AS empl WHERE amount > ( SELECT MIN(value) FROM products AS sale WHERE sale.status = empl.status );
{ "outer_table": "departments", "inner_table": "products", "outer_alias": "empl", "inner_alias": "sale", "proj_col": "value", "filter_col": "amount", "agg_col": "value", "agg_fn": "MIN", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_train_00058
train
T2
v2
Schema: branches (alias: srvc)(salary, code, name, level) regions(id, code, status, date) Task: Retrieve salary from branches that have at least one corresponding entry in regions sharing the same status. SQL:
SELECT salary FROM branches AS srvc WHERE EXISTS ( SELECT 1 FROM regions AS rgn WHERE rgn.status = srvc.status );
{ "outer_table": "branches", "inner_table": "regions", "outer_alias": "srvc", "inner_alias": "rgn", "proj_col": "salary", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00059
train
T2
v2
Schema: shipments (alias: ordr)(id, amount, status, level) departments(id, code, level, amount) Task: Find value from shipments where a matching record exists in departments with the same id. SQL:
SELECT value FROM shipments AS ordr WHERE EXISTS ( SELECT 1 FROM departments AS cust WHERE cust.id = ordr.id );
{ "outer_table": "shipments", "inner_table": "departments", "outer_alias": "ordr", "inner_alias": "cust", "proj_col": "value", "join_col": "id", "correlated_ref": "ordr.id", "token_group": "T2" }
cs8_train_00060
train
T2
v1
Schema: products (alias: prod)(level, type, id, code) categories(value, level, date, type) Task: Find amount from products where type appears in categories entries with matching type. SQL:
SELECT amount FROM products AS prod WHERE type IN ( SELECT type FROM categories AS ordr WHERE ordr.type = prod.type );
{ "outer_table": "products", "inner_table": "categories", "outer_alias": "prod", "inner_alias": "ordr", "proj_col": "amount", "filter_col": "type", "join_col": "type", "correlated_ref": "prod.type", "token_group": "T1" }
cs8_train_00061
train
T1
v2
Schema: transactions (alias: ordr)(code, type, amount, value) projects(code, name, type, id) Task: Find id from transactions where a matching record exists in projects with the same level. SQL:
SELECT id FROM transactions AS ordr WHERE EXISTS ( SELECT 1 FROM projects AS catg WHERE catg.level = ordr.level );
{ "outer_table": "transactions", "inner_table": "projects", "outer_alias": "ordr", "inner_alias": "catg", "proj_col": "id", "join_col": "level", "correlated_ref": "ordr.level", "token_group": "T2" }
cs8_train_00062
train
T2
v1
Schema: transactions (alias: cust)(type, code, status, level) categories(name, salary, date, type) Task: Find code from transactions where code appears in categories entries with matching type. SQL:
SELECT code FROM transactions AS cust WHERE code IN ( SELECT code FROM categories AS budg WHERE budg.type = cust.type );
{ "outer_table": "transactions", "inner_table": "categories", "outer_alias": "cust", "inner_alias": "budg", "proj_col": "code", "filter_col": "code", "join_col": "type", "correlated_ref": "cust.type", "token_group": "T1" }
cs8_train_00063
train
T1
v2
Schema: categories (alias: whs)(status, amount, level, date) employees(date, id, status, salary) Task: Find value from categories where a matching record exists in employees with the same type. SQL:
SELECT value FROM categories AS whs WHERE EXISTS ( SELECT 1 FROM employees AS empl WHERE empl.type = whs.type );
{ "outer_table": "categories", "inner_table": "employees", "outer_alias": "whs", "inner_alias": "empl", "proj_col": "value", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00064
train
T2
v3
Schema: customers (alias: budg)(name, amount, level, type) tasks(type, status, code, date) Task: Retrieve value from customers with value above the MIN(salary) of tasks rows sharing the same code. SQL:
SELECT value FROM customers AS budg WHERE value > ( SELECT MIN(salary) FROM tasks AS catg WHERE catg.code = budg.code );
{ "outer_table": "customers", "inner_table": "tasks", "outer_alias": "budg", "inner_alias": "catg", "proj_col": "value", "filter_col": "value", "agg_col": "salary", "agg_fn": "MIN", "join_col": "code", "correlated_ref": "budg.code", "token_group": "T2" }
cs8_train_00065
train
T2
v2
Schema: departments (alias: empl)(type, value, id, code) categories(type, date, level, status) Task: Retrieve value from departments that have at least one corresponding entry in categories sharing the same type. SQL:
SELECT value FROM departments AS empl WHERE EXISTS ( SELECT 1 FROM categories AS dept WHERE dept.type = empl.type );
{ "outer_table": "departments", "inner_table": "categories", "outer_alias": "empl", "inner_alias": "dept", "proj_col": "value", "join_col": "type", "correlated_ref": "empl.type", "token_group": "T2" }
cs8_train_00066
train
T2
v1
Schema: suppliers (alias: empl)(type, value, status, salary) transactions(type, status, id, date) Task: Find code from suppliers where level appears in transactions entries with matching id. SQL:
SELECT code FROM suppliers AS empl WHERE level IN ( SELECT level FROM transactions AS catg WHERE catg.id = empl.id );
{ "outer_table": "suppliers", "inner_table": "transactions", "outer_alias": "empl", "inner_alias": "catg", "proj_col": "code", "filter_col": "level", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_train_00067
train
T2
v3
Schema: transactions (alias: whs)(value, level, amount, type) products(date, type, status, name) Task: Retrieve id from transactions with salary above the SUM(salary) of products rows sharing the same type. SQL:
SELECT id FROM transactions AS whs WHERE salary > ( SELECT SUM(salary) FROM products AS ordr WHERE ordr.type = whs.type );
{ "outer_table": "transactions", "inner_table": "products", "outer_alias": "whs", "inner_alias": "ordr", "proj_col": "id", "filter_col": "salary", "agg_col": "salary", "agg_fn": "SUM", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00068
train
T2
v3
Schema: invoices (alias: shp)(code, id, type, date) projects(status, level, code, salary) Task: Retrieve salary from invoices with amount above the AVG(value) of projects rows sharing the same code. SQL:
SELECT salary FROM invoices AS shp WHERE amount > ( SELECT AVG(value) FROM projects AS inv WHERE inv.code = shp.code );
{ "outer_table": "invoices", "inner_table": "projects", "outer_alias": "shp", "inner_alias": "inv", "proj_col": "salary", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "shp.code", "token_group": "T2" }
cs8_train_00069
train
T2
v3
Schema: projects (alias: mgr)(value, amount, date, name) tasks(type, amount, salary, status) Task: Retrieve salary from projects with value above the MIN(value) of tasks rows sharing the same type. SQL:
SELECT salary FROM projects AS mgr WHERE value > ( SELECT MIN(value) FROM tasks AS acct WHERE acct.type = mgr.type );
{ "outer_table": "projects", "inner_table": "tasks", "outer_alias": "mgr", "inner_alias": "acct", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00070
train
T1
v2
Schema: invoices (alias: shp)(type, date, amount, value) categories(code, date, name, status) Task: Find value from invoices where a matching record exists in categories with the same status. SQL:
SELECT value FROM invoices AS shp WHERE EXISTS ( SELECT 1 FROM categories AS whs WHERE whs.status = shp.status );
{ "outer_table": "invoices", "inner_table": "categories", "outer_alias": "shp", "inner_alias": "whs", "proj_col": "value", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_train_00071
train
T2
v2
Schema: orders (alias: empl)(code, name, salary, id) branches(value, amount, salary, id) Task: Retrieve salary from orders that have at least one corresponding entry in branches sharing the same type. SQL:
SELECT salary FROM orders AS empl WHERE EXISTS ( SELECT 1 FROM branches AS shp WHERE shp.type = empl.type );
{ "outer_table": "orders", "inner_table": "branches", "outer_alias": "empl", "inner_alias": "shp", "proj_col": "salary", "join_col": "type", "correlated_ref": "empl.type", "token_group": "T2" }
cs8_train_00072
train
T2
v2
Schema: branches (alias: ordr)(status, salary, name, level) projects(id, salary, amount, status) Task: Retrieve salary from branches that have at least one corresponding entry in projects sharing the same type. SQL:
SELECT salary FROM branches AS ordr WHERE EXISTS ( SELECT 1 FROM projects AS sale WHERE sale.type = ordr.type );
{ "outer_table": "branches", "inner_table": "projects", "outer_alias": "ordr", "inner_alias": "sale", "proj_col": "salary", "join_col": "type", "correlated_ref": "ordr.type", "token_group": "T2" }
cs8_train_00073
train
T2
v1
Schema: warehouses (alias: budg)(code, id, salary, amount) employees(status, type, date, name) Task: Retrieve name from warehouses whose type is found in employees rows where level matches the outer record. SQL:
SELECT name FROM warehouses AS budg WHERE type IN ( SELECT type FROM employees AS mgr WHERE mgr.level = budg.level );
{ "outer_table": "warehouses", "inner_table": "employees", "outer_alias": "budg", "inner_alias": "mgr", "proj_col": "name", "filter_col": "type", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00074
train
T2
v3
Schema: projects (alias: mgr)(id, value, salary, name) accounts(code, amount, salary, name) Task: Find salary from projects where value exceeds the average value from accounts for the same code. SQL:
SELECT salary FROM projects AS mgr WHERE value > ( SELECT AVG(value) FROM accounts AS sale WHERE sale.code = mgr.code );
{ "outer_table": "projects", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "sale", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "mgr.code", "token_group": "T1" }
cs8_train_00075
train
T1
v1
Schema: suppliers (alias: acct)(amount, status, id, value) branches(name, salary, amount, level) Task: Select value from suppliers where code exists in branches for the same type. SQL:
SELECT value FROM suppliers AS acct WHERE code IN ( SELECT code FROM branches AS empl WHERE empl.type = acct.type );
{ "outer_table": "suppliers", "inner_table": "branches", "outer_alias": "acct", "inner_alias": "empl", "proj_col": "value", "filter_col": "code", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_train_00076
train
T1
v1
Schema: categories (alias: srvc)(date, salary, code, status) departments(salary, type, value, status) Task: Find salary from categories where id appears in departments entries with matching code. SQL:
SELECT salary FROM categories AS srvc WHERE id IN ( SELECT id FROM departments AS sale WHERE sale.code = srvc.code );
{ "outer_table": "categories", "inner_table": "departments", "outer_alias": "srvc", "inner_alias": "sale", "proj_col": "salary", "filter_col": "id", "join_col": "code", "correlated_ref": "srvc.code", "token_group": "T2" }
cs8_train_00077
train
T2
v3
Schema: shipments (alias: shp)(salary, amount, name, status) regions(status, salary, code, amount) Task: Retrieve id from shipments with value above the MAX(salary) of regions rows sharing the same type. SQL:
SELECT id FROM shipments AS shp WHERE value > ( SELECT MAX(salary) FROM regions AS catg WHERE catg.type = shp.type );
{ "outer_table": "shipments", "inner_table": "regions", "outer_alias": "shp", "inner_alias": "catg", "proj_col": "id", "filter_col": "value", "agg_col": "salary", "agg_fn": "MAX", "join_col": "type", "correlated_ref": "shp.type", "token_group": "T2" }
cs8_train_00078
train
T2
v3
Schema: invoices (alias: dept)(id, salary, value, date) transactions(status, level, value, type) Task: Retrieve name from invoices with value above the MAX(salary) of transactions rows sharing the same id. SQL:
SELECT name FROM invoices AS dept WHERE value > ( SELECT MAX(salary) FROM transactions AS shp WHERE shp.id = dept.id );
{ "outer_table": "invoices", "inner_table": "transactions", "outer_alias": "dept", "inner_alias": "shp", "proj_col": "name", "filter_col": "value", "agg_col": "salary", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00079
train
T1
v2
Schema: tasks (alias: sale)(status, type, code, salary) shipments(status, code, id, salary) Task: Find amount from tasks where a matching record exists in shipments with the same id. SQL:
SELECT amount FROM tasks AS sale WHERE EXISTS ( SELECT 1 FROM shipments AS shp WHERE shp.id = sale.id );
{ "outer_table": "tasks", "inner_table": "shipments", "outer_alias": "sale", "inner_alias": "shp", "proj_col": "amount", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00080
train
T1
v2
Schema: categories (alias: inv)(date, name, level, type) invoices(level, status, date, code) Task: Retrieve id from categories that have at least one corresponding entry in invoices sharing the same type. SQL:
SELECT id FROM categories AS inv WHERE EXISTS ( SELECT 1 FROM invoices AS ord WHERE ord.type = inv.type );
{ "outer_table": "categories", "inner_table": "invoices", "outer_alias": "inv", "inner_alias": "ord", "proj_col": "id", "join_col": "type", "correlated_ref": "inv.type", "token_group": "T1" }
cs8_train_00081
train
T1
v2
Schema: orders (alias: ord)(status, value, type, name) products(code, date, id, amount) Task: Retrieve name from orders that have at least one corresponding entry in products sharing the same status. SQL:
SELECT name FROM orders AS ord WHERE EXISTS ( SELECT 1 FROM products AS cust WHERE cust.status = ord.status );
{ "outer_table": "orders", "inner_table": "products", "outer_alias": "ord", "inner_alias": "cust", "proj_col": "name", "join_col": "status", "correlated_ref": "ord.status", "token_group": "T1" }
cs8_train_00082
train
T1
v3
Schema: warehouses (alias: ordr)(type, level, name, date) categories(name, amount, status, value) Task: Find amount from warehouses where amount exceeds the average salary from categories for the same id. SQL:
SELECT amount FROM warehouses AS ordr WHERE amount > ( SELECT SUM(salary) FROM categories AS rgn WHERE rgn.id = ordr.id );
{ "outer_table": "warehouses", "inner_table": "categories", "outer_alias": "ordr", "inner_alias": "rgn", "proj_col": "amount", "filter_col": "amount", "agg_col": "salary", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "ordr.id", "token_group": "T2" }
cs8_train_00083
train
T2
v1
Schema: tasks (alias: acct)(salary, date, type, level) suppliers(type, level, salary, id) Task: Retrieve code from tasks whose id is found in suppliers rows where status matches the outer record. SQL:
SELECT code FROM tasks AS acct WHERE id IN ( SELECT id FROM suppliers AS schd WHERE schd.status = acct.status );
{ "outer_table": "tasks", "inner_table": "suppliers", "outer_alias": "acct", "inner_alias": "schd", "proj_col": "code", "filter_col": "id", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_train_00084
train
T1
v1
Schema: transactions (alias: mgr)(status, amount, name, value) warehouses(date, name, level, amount) Task: Find amount from transactions where status appears in warehouses entries with matching type. SQL:
SELECT amount FROM transactions AS mgr WHERE status IN ( SELECT status FROM warehouses AS sale WHERE sale.type = mgr.type );
{ "outer_table": "transactions", "inner_table": "warehouses", "outer_alias": "mgr", "inner_alias": "sale", "proj_col": "amount", "filter_col": "status", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00085
train
T1
v3
Schema: invoices (alias: srvc)(code, name, value, status) regions(type, amount, id, status) Task: Find id from invoices where value exceeds the average value from regions for the same id. SQL:
SELECT id FROM invoices AS srvc WHERE value > ( SELECT SUM(value) FROM regions AS budg WHERE budg.id = srvc.id );
{ "outer_table": "invoices", "inner_table": "regions", "outer_alias": "srvc", "inner_alias": "budg", "proj_col": "id", "filter_col": "value", "agg_col": "value", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "srvc.id", "token_group": "T2" }
cs8_train_00086
train
T2
v1
Schema: departments (alias: emp)(salary, id, code, status) transactions(amount, id, level, name) Task: Find id from departments where code appears in transactions entries with matching code. SQL:
SELECT id FROM departments AS emp WHERE code IN ( SELECT code FROM transactions AS srvc WHERE srvc.code = emp.code );
{ "outer_table": "departments", "inner_table": "transactions", "outer_alias": "emp", "inner_alias": "srvc", "proj_col": "id", "filter_col": "code", "join_col": "code", "correlated_ref": "emp.code", "token_group": "T1" }
cs8_train_00087
train
T1
v3
Schema: shipments (alias: lne)(salary, value, type, level) tasks(name, amount, date, level) Task: Find value from shipments where value exceeds the average salary from tasks for the same type. SQL:
SELECT value FROM shipments AS lne WHERE value > ( SELECT MIN(salary) FROM tasks AS cust WHERE cust.type = lne.type );
{ "outer_table": "shipments", "inner_table": "tasks", "outer_alias": "lne", "inner_alias": "cust", "proj_col": "value", "filter_col": "value", "agg_col": "salary", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_train_00088
train
T2
v2
Schema: projects (alias: catg)(type, salary, amount, date) invoices(code, value, id, level) Task: Find amount from projects where a matching record exists in invoices with the same id. SQL:
SELECT amount FROM projects AS catg WHERE EXISTS ( SELECT 1 FROM invoices AS acct WHERE acct.id = catg.id );
{ "outer_table": "projects", "inner_table": "invoices", "outer_alias": "catg", "inner_alias": "acct", "proj_col": "amount", "join_col": "id", "correlated_ref": "catg.id", "token_group": "T2" }
cs8_train_00089
train
T2
v3
Schema: projects (alias: sale)(code, id, name, date) regions(amount, salary, value, type) Task: Find code from projects where salary exceeds the average salary from regions for the same code. SQL:
SELECT code FROM projects AS sale WHERE salary > ( SELECT SUM(salary) FROM regions AS txn WHERE txn.code = sale.code );
{ "outer_table": "projects", "inner_table": "regions", "outer_alias": "sale", "inner_alias": "txn", "proj_col": "code", "filter_col": "salary", "agg_col": "salary", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00090
train
T1
v2
Schema: warehouses (alias: budg)(date, salary, code, level) transactions(name, code, status, value) Task: Retrieve amount from warehouses that have at least one corresponding entry in transactions sharing the same code. SQL:
SELECT amount FROM warehouses AS budg WHERE EXISTS ( SELECT 1 FROM transactions AS empl WHERE empl.code = budg.code );
{ "outer_table": "warehouses", "inner_table": "transactions", "outer_alias": "budg", "inner_alias": "empl", "proj_col": "amount", "join_col": "code", "correlated_ref": "budg.code", "token_group": "T2" }
cs8_train_00091
train
T2
v1
Schema: shipments (alias: ord)(id, status, salary, value) departments(id, level, name, amount) Task: Find id from shipments where id appears in departments entries with matching id. SQL:
SELECT id FROM shipments AS ord WHERE id IN ( SELECT id FROM departments AS empl WHERE empl.id = ord.id );
{ "outer_table": "shipments", "inner_table": "departments", "outer_alias": "ord", "inner_alias": "empl", "proj_col": "id", "filter_col": "id", "join_col": "id", "correlated_ref": "ord.id", "token_group": "T1" }
cs8_train_00092
train
T1
v3
Schema: categories (alias: dept)(code, salary, value, level) products(value, name, level, date) Task: Retrieve salary from categories with amount above the SUM(salary) of products rows sharing the same id. SQL:
SELECT salary FROM categories AS dept WHERE amount > ( SELECT SUM(salary) FROM products AS catg WHERE catg.id = dept.id );
{ "outer_table": "categories", "inner_table": "products", "outer_alias": "dept", "inner_alias": "catg", "proj_col": "salary", "filter_col": "amount", "agg_col": "salary", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00093
train
T1
v2
Schema: employees (alias: prod)(name, date, id, type) warehouses(name, code, type, id) Task: Find amount from employees where a matching record exists in warehouses with the same status. SQL:
SELECT amount FROM employees AS prod WHERE EXISTS ( SELECT 1 FROM warehouses AS cust WHERE cust.status = prod.status );
{ "outer_table": "employees", "inner_table": "warehouses", "outer_alias": "prod", "inner_alias": "cust", "proj_col": "amount", "join_col": "status", "correlated_ref": "prod.status", "token_group": "T1" }
cs8_train_00094
train
T1
v3
Schema: regions (alias: inv)(salary, level, code, id) categories(name, code, amount, salary) Task: Find id from regions where amount exceeds the average amount from categories for the same status. SQL:
SELECT id FROM regions AS inv WHERE amount > ( SELECT COUNT(amount) FROM categories AS shp WHERE shp.status = inv.status );
{ "outer_table": "regions", "inner_table": "categories", "outer_alias": "inv", "inner_alias": "shp", "proj_col": "id", "filter_col": "amount", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_train_00095
train
T1
v2
Schema: regions (alias: emp)(level, amount, name, value) tasks(value, salary, type, amount) Task: Retrieve amount from regions that have at least one corresponding entry in tasks sharing the same status. SQL:
SELECT amount FROM regions AS emp WHERE EXISTS ( SELECT 1 FROM tasks AS lne WHERE lne.status = emp.status );
{ "outer_table": "regions", "inner_table": "tasks", "outer_alias": "emp", "inner_alias": "lne", "proj_col": "amount", "join_col": "status", "correlated_ref": "emp.status", "token_group": "T1" }
cs8_train_00096
train
T1
v3
Schema: shipments (alias: shp)(amount, type, id, level) products(code, status, amount, value) Task: Find value from shipments where salary exceeds the average value from products for the same level. SQL:
SELECT value FROM shipments AS shp WHERE salary > ( SELECT MIN(value) FROM products AS txn WHERE txn.level = shp.level );
{ "outer_table": "shipments", "inner_table": "products", "outer_alias": "shp", "inner_alias": "txn", "proj_col": "value", "filter_col": "salary", "agg_col": "value", "agg_fn": "MIN", "join_col": "level", "correlated_ref": "shp.level", "token_group": "T2" }
cs8_train_00097
train
T2
v1
Schema: categories (alias: mgr)(level, id, type, date) shipments(level, amount, id, salary) Task: Find id from categories where code appears in shipments entries with matching status. SQL:
SELECT id FROM categories AS mgr WHERE code IN ( SELECT code FROM shipments AS lne WHERE lne.status = mgr.status );
{ "outer_table": "categories", "inner_table": "shipments", "outer_alias": "mgr", "inner_alias": "lne", "proj_col": "id", "filter_col": "code", "join_col": "status", "correlated_ref": "mgr.status", "token_group": "T1" }
cs8_train_00098
train
T1
v2
Schema: tasks (alias: dept)(id, name, amount, code) employees(date, value, salary, id) Task: Retrieve salary from tasks that have at least one corresponding entry in employees sharing the same id. SQL:
SELECT salary FROM tasks AS dept WHERE EXISTS ( SELECT 1 FROM employees AS prod WHERE prod.id = dept.id );
{ "outer_table": "tasks", "inner_table": "employees", "outer_alias": "dept", "inner_alias": "prod", "proj_col": "salary", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00099
train
T1
End of preview. Expand in Data Studio

cs8-rand

CS8 rand dataset — random inner alias assignment, negative control for mechanistic interpretability study

Structure

  • train.jsonl — 12,000 training examples (20 aliases × 600)
  • val.jsonl — 12,000 validation examples (20 aliases × 600)
  • alias_vocab.json — 20 aliases with T1/T2 tokenization group labels

Alias Groups

  • T1 (single-token): emp, inv, txn, mgr, ord, prod, cust, dept, acct, sale
  • T2 (two-token, generic first subtoken): shp, whs, rgn, lne, empl, ordr, catg, budg, schd, srvc

Citation

Inside-Out: A Circuit-Level Analysis of Table-Alias Scoping in Nested SQL Generation

Downloads last month
31