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
v3
Schema: products (alias: shp)(name, value, salary, code) shipments(id, value, code, level) Task: Retrieve amount from products with value above the COUNT(amount) of shipments rows sharing the same type. SQL:
SELECT amount FROM products AS shp WHERE value > ( SELECT COUNT(amount) FROM shipments AS budg WHERE budg.type = shp.type );
{ "outer_table": "products", "inner_table": "shipments", "outer_alias": "shp", "inner_alias": "budg", "proj_col": "amount", "filter_col": "value", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "type", "correlated_ref": "shp.type", "token_group": "T2" }
cs8_train_00900
train
T2
v1
Schema: accounts (alias: mgr)(status, level, value, salary) invoices(name, status, date, level) Task: Select id from accounts where level exists in invoices for the same status. SQL:
SELECT id FROM accounts AS mgr WHERE level IN ( SELECT level FROM invoices AS dept WHERE dept.status = mgr.status );
{ "outer_table": "accounts", "inner_table": "invoices", "outer_alias": "mgr", "inner_alias": "dept", "proj_col": "id", "filter_col": "level", "join_col": "status", "correlated_ref": "mgr.status", "token_group": "T1" }
cs8_train_00901
train
T1
v3
Schema: employees (alias: whs)(amount, type, value, level) shipments(amount, salary, date, code) Task: Find id from employees where amount exceeds the average amount from shipments for the same type. SQL:
SELECT id FROM employees AS whs WHERE amount > ( SELECT AVG(amount) FROM shipments AS dept WHERE dept.type = whs.type );
{ "outer_table": "employees", "inner_table": "shipments", "outer_alias": "whs", "inner_alias": "dept", "proj_col": "id", "filter_col": "amount", "agg_col": "amount", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00902
train
T2
v3
Schema: branches (alias: txn)(level, name, status, salary) warehouses(type, value, code, name) Task: Retrieve code from branches with amount above the AVG(value) of warehouses rows sharing the same code. SQL:
SELECT code FROM branches AS txn WHERE amount > ( SELECT AVG(value) FROM warehouses AS schd WHERE schd.code = txn.code );
{ "outer_table": "branches", "inner_table": "warehouses", "outer_alias": "txn", "inner_alias": "schd", "proj_col": "code", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "txn.code", "token_group": "T1" }
cs8_train_00903
train
T1
v2
Schema: suppliers (alias: srvc)(type, name, status, value) categories(level, id, date, status) Task: Retrieve salary from suppliers that have at least one corresponding entry in categories sharing the same status. SQL:
SELECT salary FROM suppliers AS srvc WHERE EXISTS ( SELECT 1 FROM categories AS budg WHERE budg.status = srvc.status );
{ "outer_table": "suppliers", "inner_table": "categories", "outer_alias": "srvc", "inner_alias": "budg", "proj_col": "salary", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00904
train
T2
v1
Schema: branches (alias: inv)(level, amount, salary, name) tasks(type, value, amount, name) Task: Select code from branches where code exists in tasks for the same id. SQL:
SELECT code FROM branches AS inv WHERE code IN ( SELECT code FROM tasks AS mgr WHERE mgr.id = inv.id );
{ "outer_table": "branches", "inner_table": "tasks", "outer_alias": "inv", "inner_alias": "mgr", "proj_col": "code", "filter_col": "code", "join_col": "id", "correlated_ref": "inv.id", "token_group": "T1" }
cs8_train_00905
train
T1
v1
Schema: tasks (alias: prod)(level, type, date, name) products(name, date, id, amount) Task: Find code from tasks where id appears in products entries with matching status. SQL:
SELECT code FROM tasks AS prod WHERE id IN ( SELECT id FROM products AS txn WHERE txn.status = prod.status );
{ "outer_table": "tasks", "inner_table": "products", "outer_alias": "prod", "inner_alias": "txn", "proj_col": "code", "filter_col": "id", "join_col": "status", "correlated_ref": "prod.status", "token_group": "T1" }
cs8_train_00906
train
T1
v1
Schema: branches (alias: acct)(status, level, name, date) invoices(date, amount, type, salary) Task: Retrieve name from branches whose code is found in invoices rows where type matches the outer record. SQL:
SELECT name FROM branches AS acct WHERE code IN ( SELECT code FROM invoices AS emp WHERE emp.type = acct.type );
{ "outer_table": "branches", "inner_table": "invoices", "outer_alias": "acct", "inner_alias": "emp", "proj_col": "name", "filter_col": "code", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_train_00907
train
T1
v2
Schema: projects (alias: prod)(type, value, level, salary) invoices(code, name, level, salary) Task: Retrieve id from projects that have at least one corresponding entry in invoices sharing the same type. SQL:
SELECT id FROM projects AS prod WHERE EXISTS ( SELECT 1 FROM invoices AS sale WHERE sale.type = prod.type );
{ "outer_table": "projects", "inner_table": "invoices", "outer_alias": "prod", "inner_alias": "sale", "proj_col": "id", "join_col": "type", "correlated_ref": "prod.type", "token_group": "T1" }
cs8_train_00908
train
T1
v1
Schema: employees (alias: budg)(type, amount, level, date) branches(type, name, status, code) Task: Retrieve name from employees whose id is found in branches rows where code matches the outer record. SQL:
SELECT name FROM employees AS budg WHERE id IN ( SELECT id FROM branches AS prod WHERE prod.code = budg.code );
{ "outer_table": "employees", "inner_table": "branches", "outer_alias": "budg", "inner_alias": "prod", "proj_col": "name", "filter_col": "id", "join_col": "code", "correlated_ref": "budg.code", "token_group": "T2" }
cs8_train_00909
train
T2
v2
Schema: categories (alias: lne)(value, id, salary, type) accounts(level, date, status, salary) Task: Retrieve name from categories that have at least one corresponding entry in accounts sharing the same level. SQL:
SELECT name FROM categories AS lne WHERE EXISTS ( SELECT 1 FROM accounts AS sale WHERE sale.level = lne.level );
{ "outer_table": "categories", "inner_table": "accounts", "outer_alias": "lne", "inner_alias": "sale", "proj_col": "name", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_train_00910
train
T2
v1
Schema: regions (alias: inv)(status, code, salary, value) projects(salary, level, amount, date) Task: Find code from regions where code appears in projects entries with matching code. SQL:
SELECT code FROM regions AS inv WHERE code IN ( SELECT code FROM projects AS ord WHERE ord.code = inv.code );
{ "outer_table": "regions", "inner_table": "projects", "outer_alias": "inv", "inner_alias": "ord", "proj_col": "code", "filter_col": "code", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00911
train
T1
v3
Schema: invoices (alias: mgr)(type, salary, value, code) suppliers(type, value, salary, amount) Task: Retrieve salary from invoices with value above the AVG(value) of suppliers rows sharing the same type. SQL:
SELECT salary FROM invoices AS mgr WHERE value > ( SELECT AVG(value) FROM suppliers AS dept WHERE dept.type = mgr.type );
{ "outer_table": "invoices", "inner_table": "suppliers", "outer_alias": "mgr", "inner_alias": "dept", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00912
train
T1
v2
Schema: accounts (alias: shp)(date, type, level, value) tasks(id, code, name, type) Task: Find amount from accounts where a matching record exists in tasks with the same status. SQL:
SELECT amount FROM accounts AS shp WHERE EXISTS ( SELECT 1 FROM tasks AS ordr WHERE ordr.status = shp.status );
{ "outer_table": "accounts", "inner_table": "tasks", "outer_alias": "shp", "inner_alias": "ordr", "proj_col": "amount", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_train_00913
train
T2
v2
Schema: transactions (alias: empl)(date, value, code, salary) departments(name, code, salary, status) Task: Retrieve name from transactions that have at least one corresponding entry in departments sharing the same status. SQL:
SELECT name FROM transactions AS empl WHERE EXISTS ( SELECT 1 FROM departments AS ord WHERE ord.status = empl.status );
{ "outer_table": "transactions", "inner_table": "departments", "outer_alias": "empl", "inner_alias": "ord", "proj_col": "name", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_train_00914
train
T2
v1
Schema: warehouses (alias: catg)(name, value, code, salary) employees(salary, date, type, value) Task: Select id from warehouses where level exists in employees for the same id. SQL:
SELECT id FROM warehouses AS catg WHERE level IN ( SELECT level FROM employees AS inv WHERE inv.id = catg.id );
{ "outer_table": "warehouses", "inner_table": "employees", "outer_alias": "catg", "inner_alias": "inv", "proj_col": "id", "filter_col": "level", "join_col": "id", "correlated_ref": "catg.id", "token_group": "T2" }
cs8_train_00915
train
T2
v1
Schema: customers (alias: rgn)(level, salary, status, id) tasks(value, status, name, type) Task: Select id from customers where type exists in tasks for the same code. SQL:
SELECT id FROM customers AS rgn WHERE type IN ( SELECT type FROM tasks AS cust WHERE cust.code = rgn.code );
{ "outer_table": "customers", "inner_table": "tasks", "outer_alias": "rgn", "inner_alias": "cust", "proj_col": "id", "filter_col": "type", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00916
train
T2
v1
Schema: projects (alias: dept)(name, level, amount, date) employees(level, type, name, value) Task: Find amount from projects where code appears in employees entries with matching code. SQL:
SELECT amount FROM projects AS dept WHERE code IN ( SELECT code FROM employees AS txn WHERE txn.code = dept.code );
{ "outer_table": "projects", "inner_table": "employees", "outer_alias": "dept", "inner_alias": "txn", "proj_col": "amount", "filter_col": "code", "join_col": "code", "correlated_ref": "dept.code", "token_group": "T1" }
cs8_train_00917
train
T1
v2
Schema: warehouses (alias: schd)(code, status, type, amount) employees(level, salary, amount, type) Task: Find id from warehouses where a matching record exists in employees with the same level. SQL:
SELECT id FROM warehouses AS schd WHERE EXISTS ( SELECT 1 FROM employees AS acct WHERE acct.level = schd.level );
{ "outer_table": "warehouses", "inner_table": "employees", "outer_alias": "schd", "inner_alias": "acct", "proj_col": "id", "join_col": "level", "correlated_ref": "schd.level", "token_group": "T2" }
cs8_train_00918
train
T2
v1
Schema: invoices (alias: rgn)(type, salary, status, id) categories(amount, value, level, code) Task: Select amount from invoices where status exists in categories for the same code. SQL:
SELECT amount FROM invoices AS rgn WHERE status IN ( SELECT status FROM categories AS lne WHERE lne.code = rgn.code );
{ "outer_table": "invoices", "inner_table": "categories", "outer_alias": "rgn", "inner_alias": "lne", "proj_col": "amount", "filter_col": "status", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00919
train
T2
v1
Schema: tasks (alias: mgr)(date, type, id, level) categories(level, salary, status, value) Task: Retrieve id from tasks whose type is found in categories rows where code matches the outer record. SQL:
SELECT id FROM tasks AS mgr WHERE type IN ( SELECT type FROM categories AS emp WHERE emp.code = mgr.code );
{ "outer_table": "tasks", "inner_table": "categories", "outer_alias": "mgr", "inner_alias": "emp", "proj_col": "id", "filter_col": "type", "join_col": "code", "correlated_ref": "mgr.code", "token_group": "T1" }
cs8_train_00920
train
T1
v2
Schema: transactions (alias: dept)(value, status, id, salary) categories(amount, id, type, value) Task: Find code from transactions where a matching record exists in categories with the same status. SQL:
SELECT code FROM transactions AS dept WHERE EXISTS ( SELECT 1 FROM categories AS lne WHERE lne.status = dept.status );
{ "outer_table": "transactions", "inner_table": "categories", "outer_alias": "dept", "inner_alias": "lne", "proj_col": "code", "join_col": "status", "correlated_ref": "dept.status", "token_group": "T1" }
cs8_train_00921
train
T1
v1
Schema: departments (alias: ord)(salary, status, value, id) suppliers(date, name, status, code) Task: Select id from departments where code exists in suppliers for the same level. SQL:
SELECT id FROM departments AS ord WHERE code IN ( SELECT code FROM suppliers AS emp WHERE emp.level = ord.level );
{ "outer_table": "departments", "inner_table": "suppliers", "outer_alias": "ord", "inner_alias": "emp", "proj_col": "id", "filter_col": "code", "join_col": "level", "correlated_ref": "ord.level", "token_group": "T1" }
cs8_train_00922
train
T1
v1
Schema: suppliers (alias: whs)(id, date, code, status) branches(id, code, name, type) Task: Select name from suppliers where level exists in branches for the same id. SQL:
SELECT name FROM suppliers AS whs WHERE level IN ( SELECT level FROM branches AS emp WHERE emp.id = whs.id );
{ "outer_table": "suppliers", "inner_table": "branches", "outer_alias": "whs", "inner_alias": "emp", "proj_col": "name", "filter_col": "level", "join_col": "id", "correlated_ref": "whs.id", "token_group": "T2" }
cs8_train_00923
train
T2
v3
Schema: products (alias: schd)(type, amount, name, salary) projects(type, salary, date, id) Task: Retrieve salary from products with value above the COUNT(amount) of projects rows sharing the same code. SQL:
SELECT salary FROM products AS schd WHERE value > ( SELECT COUNT(amount) FROM projects AS prod WHERE prod.code = schd.code );
{ "outer_table": "products", "inner_table": "projects", "outer_alias": "schd", "inner_alias": "prod", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "code", "correlated_ref": "schd.code", "token_group": "T2" }
cs8_train_00924
train
T2
v3
Schema: warehouses (alias: sale)(level, name, status, code) regions(name, code, amount, type) Task: Find value from warehouses where salary exceeds the average amount from regions for the same type. SQL:
SELECT value FROM warehouses AS sale WHERE salary > ( SELECT MIN(amount) FROM regions AS mgr WHERE mgr.type = sale.type );
{ "outer_table": "warehouses", "inner_table": "regions", "outer_alias": "sale", "inner_alias": "mgr", "proj_col": "value", "filter_col": "salary", "agg_col": "amount", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00925
train
T1
v2
Schema: projects (alias: mgr)(level, date, amount, value) accounts(date, level, id, code) Task: Retrieve name from projects that have at least one corresponding entry in accounts sharing the same type. SQL:
SELECT name FROM projects AS mgr WHERE EXISTS ( SELECT 1 FROM accounts AS shp WHERE shp.type = mgr.type );
{ "outer_table": "projects", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "shp", "proj_col": "name", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00926
train
T1
v1
Schema: accounts (alias: budg)(salary, name, id, code) categories(code, name, id, type) Task: Select id from accounts where id exists in categories for the same level. SQL:
SELECT id FROM accounts AS budg WHERE id IN ( SELECT id FROM categories AS schd WHERE schd.level = budg.level );
{ "outer_table": "accounts", "inner_table": "categories", "outer_alias": "budg", "inner_alias": "schd", "proj_col": "id", "filter_col": "id", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00927
train
T2
v3
Schema: accounts (alias: mgr)(date, type, status, code) departments(date, salary, amount, level) Task: Retrieve salary from accounts with value above the MIN(value) of departments rows sharing the same type. SQL:
SELECT salary FROM accounts AS mgr WHERE value > ( SELECT MIN(value) FROM departments AS inv WHERE inv.type = mgr.type );
{ "outer_table": "accounts", "inner_table": "departments", "outer_alias": "mgr", "inner_alias": "inv", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00928
train
T1
v1
Schema: branches (alias: dept)(level, value, name, status) departments(type, date, salary, amount) Task: Select id from branches where status exists in departments for the same status. SQL:
SELECT id FROM branches AS dept WHERE status IN ( SELECT status FROM departments AS catg WHERE catg.status = dept.status );
{ "outer_table": "branches", "inner_table": "departments", "outer_alias": "dept", "inner_alias": "catg", "proj_col": "id", "filter_col": "status", "join_col": "status", "correlated_ref": "dept.status", "token_group": "T1" }
cs8_train_00929
train
T1
v1
Schema: warehouses (alias: shp)(status, level, salary, date) customers(type, name, salary, value) Task: Find amount from warehouses where type appears in customers entries with matching status. SQL:
SELECT amount FROM warehouses AS shp WHERE type IN ( SELECT type FROM customers AS sale WHERE sale.status = shp.status );
{ "outer_table": "warehouses", "inner_table": "customers", "outer_alias": "shp", "inner_alias": "sale", "proj_col": "amount", "filter_col": "type", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_train_00930
train
T2
v3
Schema: products (alias: rgn)(id, salary, status, level) projects(date, status, value, level) Task: Retrieve value from products with value above the SUM(value) of projects rows sharing the same code. SQL:
SELECT value FROM products AS rgn WHERE value > ( SELECT SUM(value) FROM projects AS srvc WHERE srvc.code = rgn.code );
{ "outer_table": "products", "inner_table": "projects", "outer_alias": "rgn", "inner_alias": "srvc", "proj_col": "value", "filter_col": "value", "agg_col": "value", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00931
train
T2
v3
Schema: customers (alias: srvc)(level, type, id, salary) warehouses(date, value, type, name) Task: Retrieve salary from customers with amount above the SUM(value) of warehouses rows sharing the same code. SQL:
SELECT salary FROM customers AS srvc WHERE amount > ( SELECT SUM(value) FROM warehouses AS txn WHERE txn.code = srvc.code );
{ "outer_table": "customers", "inner_table": "warehouses", "outer_alias": "srvc", "inner_alias": "txn", "proj_col": "salary", "filter_col": "amount", "agg_col": "value", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "srvc.code", "token_group": "T2" }
cs8_train_00932
train
T2
v3
Schema: projects (alias: rgn)(id, level, date, status) products(name, date, amount, type) Task: Find value from projects where salary exceeds the average salary from products for the same status. SQL:
SELECT value FROM projects AS rgn WHERE salary > ( SELECT COUNT(salary) FROM products AS ord WHERE ord.status = rgn.status );
{ "outer_table": "projects", "inner_table": "products", "outer_alias": "rgn", "inner_alias": "ord", "proj_col": "value", "filter_col": "salary", "agg_col": "salary", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "rgn.status", "token_group": "T2" }
cs8_train_00933
train
T2
v1
Schema: branches (alias: rgn)(code, id, date, value) regions(code, name, status, date) Task: Find code from branches where code appears in regions entries with matching status. SQL:
SELECT code FROM branches AS rgn WHERE code IN ( SELECT code FROM regions AS schd WHERE schd.status = rgn.status );
{ "outer_table": "branches", "inner_table": "regions", "outer_alias": "rgn", "inner_alias": "schd", "proj_col": "code", "filter_col": "code", "join_col": "status", "correlated_ref": "rgn.status", "token_group": "T2" }
cs8_train_00934
train
T2
v3
Schema: employees (alias: sale)(status, type, id, name) transactions(status, code, id, name) Task: Find amount from employees where salary exceeds the average value from transactions for the same id. SQL:
SELECT amount FROM employees AS sale WHERE salary > ( SELECT MAX(value) FROM transactions AS cust WHERE cust.id = sale.id );
{ "outer_table": "employees", "inner_table": "transactions", "outer_alias": "sale", "inner_alias": "cust", "proj_col": "amount", "filter_col": "salary", "agg_col": "value", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00935
train
T1
v3
Schema: suppliers (alias: budg)(salary, date, value, level) transactions(amount, type, code, name) Task: Find id from suppliers where amount exceeds the average value from transactions for the same level. SQL:
SELECT id FROM suppliers AS budg WHERE amount > ( SELECT AVG(value) FROM transactions AS lne WHERE lne.level = budg.level );
{ "outer_table": "suppliers", "inner_table": "transactions", "outer_alias": "budg", "inner_alias": "lne", "proj_col": "id", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00936
train
T2
v3
Schema: branches (alias: sale)(status, level, value, amount) products(date, level, salary, status) Task: Retrieve id from branches with value above the MAX(amount) of products rows sharing the same id. SQL:
SELECT id FROM branches AS sale WHERE value > ( SELECT MAX(amount) FROM products AS emp WHERE emp.id = sale.id );
{ "outer_table": "branches", "inner_table": "products", "outer_alias": "sale", "inner_alias": "emp", "proj_col": "id", "filter_col": "value", "agg_col": "amount", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00937
train
T1
v2
Schema: employees (alias: ord)(level, status, amount, value) warehouses(code, date, amount, salary) Task: Retrieve name from employees that have at least one corresponding entry in warehouses sharing the same code. SQL:
SELECT name FROM employees AS ord WHERE EXISTS ( SELECT 1 FROM warehouses AS txn WHERE txn.code = ord.code );
{ "outer_table": "employees", "inner_table": "warehouses", "outer_alias": "ord", "inner_alias": "txn", "proj_col": "name", "join_col": "code", "correlated_ref": "ord.code", "token_group": "T1" }
cs8_train_00938
train
T1
v3
Schema: employees (alias: inv)(amount, level, id, date) branches(level, value, name, code) Task: Find name from employees where salary exceeds the average value from branches for the same status. SQL:
SELECT name FROM employees AS inv WHERE salary > ( SELECT AVG(value) FROM branches AS cust WHERE cust.status = inv.status );
{ "outer_table": "employees", "inner_table": "branches", "outer_alias": "inv", "inner_alias": "cust", "proj_col": "name", "filter_col": "salary", "agg_col": "value", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_train_00939
train
T1
v1
Schema: categories (alias: catg)(date, amount, value, salary) accounts(name, code, salary, date) Task: Retrieve name from categories whose type is found in accounts rows where type matches the outer record. SQL:
SELECT name FROM categories AS catg WHERE type IN ( SELECT type FROM accounts AS mgr WHERE mgr.type = catg.type );
{ "outer_table": "categories", "inner_table": "accounts", "outer_alias": "catg", "inner_alias": "mgr", "proj_col": "name", "filter_col": "type", "join_col": "type", "correlated_ref": "catg.type", "token_group": "T2" }
cs8_train_00940
train
T2
v2
Schema: shipments (alias: empl)(date, code, type, level) employees(level, name, amount, value) Task: Retrieve id from shipments that have at least one corresponding entry in employees sharing the same status. SQL:
SELECT id FROM shipments AS empl WHERE EXISTS ( SELECT 1 FROM employees AS rgn WHERE rgn.status = empl.status );
{ "outer_table": "shipments", "inner_table": "employees", "outer_alias": "empl", "inner_alias": "rgn", "proj_col": "id", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_train_00941
train
T2
v1
Schema: customers (alias: shp)(salary, level, value, type) shipments(id, code, salary, value) Task: Find amount from customers where type appears in shipments entries with matching status. SQL:
SELECT amount FROM customers AS shp WHERE type IN ( SELECT type FROM shipments AS catg WHERE catg.status = shp.status );
{ "outer_table": "customers", "inner_table": "shipments", "outer_alias": "shp", "inner_alias": "catg", "proj_col": "amount", "filter_col": "type", "join_col": "status", "correlated_ref": "shp.status", "token_group": "T2" }
cs8_train_00942
train
T2
v2
Schema: products (alias: ordr)(date, status, level, name) suppliers(level, value, date, salary) Task: Find salary from products where a matching record exists in suppliers with the same id. SQL:
SELECT salary FROM products AS ordr WHERE EXISTS ( SELECT 1 FROM suppliers AS shp WHERE shp.id = ordr.id );
{ "outer_table": "products", "inner_table": "suppliers", "outer_alias": "ordr", "inner_alias": "shp", "proj_col": "salary", "join_col": "id", "correlated_ref": "ordr.id", "token_group": "T2" }
cs8_train_00943
train
T2
v1
Schema: customers (alias: srvc)(type, value, status, code) orders(id, type, salary, level) Task: Select value from customers where code exists in orders for the same type. SQL:
SELECT value FROM customers AS srvc WHERE code IN ( SELECT code FROM orders AS lne WHERE lne.type = srvc.type );
{ "outer_table": "customers", "inner_table": "orders", "outer_alias": "srvc", "inner_alias": "lne", "proj_col": "value", "filter_col": "code", "join_col": "type", "correlated_ref": "srvc.type", "token_group": "T2" }
cs8_train_00944
train
T2
v1
Schema: projects (alias: mgr)(amount, salary, level, type) orders(salary, status, value, id) Task: Retrieve name from projects whose code is found in orders rows where level matches the outer record. SQL:
SELECT name FROM projects AS mgr WHERE code IN ( SELECT code FROM orders AS sale WHERE sale.level = mgr.level );
{ "outer_table": "projects", "inner_table": "orders", "outer_alias": "mgr", "inner_alias": "sale", "proj_col": "name", "filter_col": "code", "join_col": "level", "correlated_ref": "mgr.level", "token_group": "T1" }
cs8_train_00945
train
T1
v1
Schema: employees (alias: dept)(name, date, amount, level) products(value, code, amount, name) Task: Retrieve code from employees whose level is found in products rows where level matches the outer record. SQL:
SELECT code FROM employees AS dept WHERE level IN ( SELECT level FROM products AS whs WHERE whs.level = dept.level );
{ "outer_table": "employees", "inner_table": "products", "outer_alias": "dept", "inner_alias": "whs", "proj_col": "code", "filter_col": "level", "join_col": "level", "correlated_ref": "dept.level", "token_group": "T1" }
cs8_train_00946
train
T1
v2
Schema: tasks (alias: lne)(level, amount, code, date) categories(date, id, code, type) Task: Retrieve amount from tasks that have at least one corresponding entry in categories sharing the same level. SQL:
SELECT amount FROM tasks AS lne WHERE EXISTS ( SELECT 1 FROM categories AS shp WHERE shp.level = lne.level );
{ "outer_table": "tasks", "inner_table": "categories", "outer_alias": "lne", "inner_alias": "shp", "proj_col": "amount", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_train_00947
train
T2
v2
Schema: departments (alias: sale)(level, salary, id, name) orders(salary, status, level, amount) Task: Retrieve code from departments that have at least one corresponding entry in orders sharing the same code. SQL:
SELECT code FROM departments AS sale WHERE EXISTS ( SELECT 1 FROM orders AS lne WHERE lne.code = sale.code );
{ "outer_table": "departments", "inner_table": "orders", "outer_alias": "sale", "inner_alias": "lne", "proj_col": "code", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00948
train
T1
v1
Schema: products (alias: whs)(status, name, value, code) suppliers(code, amount, status, id) Task: Select code from products where code exists in suppliers for the same status. SQL:
SELECT code FROM products AS whs WHERE code IN ( SELECT code FROM suppliers AS dept WHERE dept.status = whs.status );
{ "outer_table": "products", "inner_table": "suppliers", "outer_alias": "whs", "inner_alias": "dept", "proj_col": "code", "filter_col": "code", "join_col": "status", "correlated_ref": "whs.status", "token_group": "T2" }
cs8_train_00949
train
T2
v2
Schema: suppliers (alias: emp)(salary, level, id, value) invoices(id, level, salary, code) Task: Find id from suppliers where a matching record exists in invoices with the same code. SQL:
SELECT id FROM suppliers AS emp WHERE EXISTS ( SELECT 1 FROM invoices AS sale WHERE sale.code = emp.code );
{ "outer_table": "suppliers", "inner_table": "invoices", "outer_alias": "emp", "inner_alias": "sale", "proj_col": "id", "join_col": "code", "correlated_ref": "emp.code", "token_group": "T1" }
cs8_train_00950
train
T1
v3
Schema: warehouses (alias: ordr)(amount, type, value, code) branches(salary, name, value, type) Task: Find salary from warehouses where salary exceeds the average value from branches for the same type. SQL:
SELECT salary FROM warehouses AS ordr WHERE salary > ( SELECT AVG(value) FROM branches AS srvc WHERE srvc.type = ordr.type );
{ "outer_table": "warehouses", "inner_table": "branches", "outer_alias": "ordr", "inner_alias": "srvc", "proj_col": "salary", "filter_col": "salary", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "ordr.type", "token_group": "T2" }
cs8_train_00951
train
T2
v2
Schema: regions (alias: ord)(status, level, salary, amount) warehouses(name, id, level, salary) Task: Find code from regions where a matching record exists in warehouses with the same type. SQL:
SELECT code FROM regions AS ord WHERE EXISTS ( SELECT 1 FROM warehouses AS ordr WHERE ordr.type = ord.type );
{ "outer_table": "regions", "inner_table": "warehouses", "outer_alias": "ord", "inner_alias": "ordr", "proj_col": "code", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_train_00952
train
T1
v1
Schema: departments (alias: whs)(level, salary, code, date) employees(type, amount, status, code) Task: Select name from departments where status exists in employees for the same type. SQL:
SELECT name FROM departments AS whs WHERE status IN ( SELECT status FROM employees AS schd WHERE schd.type = whs.type );
{ "outer_table": "departments", "inner_table": "employees", "outer_alias": "whs", "inner_alias": "schd", "proj_col": "name", "filter_col": "status", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00953
train
T2
v3
Schema: employees (alias: ord)(name, type, id, value) customers(name, status, code, date) Task: Retrieve code from employees with salary above the AVG(amount) of customers rows sharing the same id. SQL:
SELECT code FROM employees AS ord WHERE salary > ( SELECT AVG(amount) FROM customers AS acct WHERE acct.id = ord.id );
{ "outer_table": "employees", "inner_table": "customers", "outer_alias": "ord", "inner_alias": "acct", "proj_col": "code", "filter_col": "salary", "agg_col": "amount", "agg_fn": "AVG", "join_col": "id", "correlated_ref": "ord.id", "token_group": "T1" }
cs8_train_00954
train
T1
v1
Schema: orders (alias: schd)(code, id, date, status) shipments(name, level, type, id) Task: Retrieve value from orders whose level is found in shipments rows where status matches the outer record. SQL:
SELECT value FROM orders AS schd WHERE level IN ( SELECT level FROM shipments AS shp WHERE shp.status = schd.status );
{ "outer_table": "orders", "inner_table": "shipments", "outer_alias": "schd", "inner_alias": "shp", "proj_col": "value", "filter_col": "level", "join_col": "status", "correlated_ref": "schd.status", "token_group": "T2" }
cs8_train_00955
train
T2
v3
Schema: orders (alias: prod)(date, code, status, id) warehouses(salary, status, date, amount) Task: Retrieve name from orders with salary above the MAX(amount) of warehouses rows sharing the same code. SQL:
SELECT name FROM orders AS prod WHERE salary > ( SELECT MAX(amount) FROM warehouses AS rgn WHERE rgn.code = prod.code );
{ "outer_table": "orders", "inner_table": "warehouses", "outer_alias": "prod", "inner_alias": "rgn", "proj_col": "name", "filter_col": "salary", "agg_col": "amount", "agg_fn": "MAX", "join_col": "code", "correlated_ref": "prod.code", "token_group": "T1" }
cs8_train_00956
train
T1
v3
Schema: invoices (alias: cust)(salary, name, id, level) suppliers(id, name, amount, value) Task: Find name from invoices where value exceeds the average salary from suppliers for the same code. SQL:
SELECT name FROM invoices AS cust WHERE value > ( SELECT MAX(salary) FROM suppliers AS emp WHERE emp.code = cust.code );
{ "outer_table": "invoices", "inner_table": "suppliers", "outer_alias": "cust", "inner_alias": "emp", "proj_col": "name", "filter_col": "value", "agg_col": "salary", "agg_fn": "MAX", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_train_00957
train
T1
v3
Schema: transactions (alias: rgn)(amount, name, id, type) customers(salary, value, amount, type) Task: Retrieve value from transactions with salary above the AVG(value) of customers rows sharing the same code. SQL:
SELECT value FROM transactions AS rgn WHERE salary > ( SELECT AVG(value) FROM customers AS catg WHERE catg.code = rgn.code );
{ "outer_table": "transactions", "inner_table": "customers", "outer_alias": "rgn", "inner_alias": "catg", "proj_col": "value", "filter_col": "salary", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00958
train
T2
v3
Schema: departments (alias: txn)(value, name, date, id) employees(value, name, type, salary) Task: Find salary from departments where value exceeds the average amount from employees for the same id. SQL:
SELECT salary FROM departments AS txn WHERE value > ( SELECT AVG(amount) FROM employees AS sale WHERE sale.id = txn.id );
{ "outer_table": "departments", "inner_table": "employees", "outer_alias": "txn", "inner_alias": "sale", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "AVG", "join_col": "id", "correlated_ref": "txn.id", "token_group": "T1" }
cs8_train_00959
train
T1
v1
Schema: products (alias: budg)(value, type, name, status) employees(status, amount, id, date) Task: Select salary from products where id exists in employees for the same code. SQL:
SELECT salary FROM products AS budg WHERE id IN ( SELECT id FROM employees AS schd WHERE schd.code = budg.code );
{ "outer_table": "products", "inner_table": "employees", "outer_alias": "budg", "inner_alias": "schd", "proj_col": "salary", "filter_col": "id", "join_col": "code", "correlated_ref": "budg.code", "token_group": "T2" }
cs8_train_00960
train
T2
v3
Schema: transactions (alias: emp)(name, code, date, level) shipments(type, level, id, name) Task: Retrieve name from transactions with amount above the MIN(salary) of shipments rows sharing the same level. SQL:
SELECT name FROM transactions AS emp WHERE amount > ( SELECT MIN(salary) FROM shipments AS lne WHERE lne.level = emp.level );
{ "outer_table": "transactions", "inner_table": "shipments", "outer_alias": "emp", "inner_alias": "lne", "proj_col": "name", "filter_col": "amount", "agg_col": "salary", "agg_fn": "MIN", "join_col": "level", "correlated_ref": "emp.level", "token_group": "T1" }
cs8_train_00961
train
T1
v1
Schema: regions (alias: whs)(amount, level, type, status) invoices(status, code, type, level) Task: Find name from regions where code appears in invoices entries with matching type. SQL:
SELECT name FROM regions AS whs WHERE code IN ( SELECT code FROM invoices AS mgr WHERE mgr.type = whs.type );
{ "outer_table": "regions", "inner_table": "invoices", "outer_alias": "whs", "inner_alias": "mgr", "proj_col": "name", "filter_col": "code", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00962
train
T2
v3
Schema: suppliers (alias: ordr)(code, salary, value, amount) tasks(salary, amount, code, date) Task: Find id from suppliers where amount exceeds the average salary from tasks for the same id. SQL:
SELECT id FROM suppliers AS ordr WHERE amount > ( SELECT SUM(salary) FROM tasks AS catg WHERE catg.id = ordr.id );
{ "outer_table": "suppliers", "inner_table": "tasks", "outer_alias": "ordr", "inner_alias": "catg", "proj_col": "id", "filter_col": "amount", "agg_col": "salary", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "ordr.id", "token_group": "T2" }
cs8_train_00963
train
T2
v1
Schema: regions (alias: srvc)(code, status, id, name) products(status, name, date, level) Task: Select value from regions where code exists in products for the same type. SQL:
SELECT value FROM regions AS srvc WHERE code IN ( SELECT code FROM products AS inv WHERE inv.type = srvc.type );
{ "outer_table": "regions", "inner_table": "products", "outer_alias": "srvc", "inner_alias": "inv", "proj_col": "value", "filter_col": "code", "join_col": "type", "correlated_ref": "srvc.type", "token_group": "T2" }
cs8_train_00964
train
T2
v2
Schema: invoices (alias: ord)(salary, date, id, status) branches(id, code, date, name) Task: Find amount from invoices where a matching record exists in branches with the same id. SQL:
SELECT amount FROM invoices AS ord WHERE EXISTS ( SELECT 1 FROM branches AS empl WHERE empl.id = ord.id );
{ "outer_table": "invoices", "inner_table": "branches", "outer_alias": "ord", "inner_alias": "empl", "proj_col": "amount", "join_col": "id", "correlated_ref": "ord.id", "token_group": "T1" }
cs8_train_00965
train
T1
v1
Schema: products (alias: empl)(amount, code, date, value) warehouses(salary, value, name, type) Task: Select name from products where code exists in warehouses for the same level. SQL:
SELECT name FROM products AS empl WHERE code IN ( SELECT code FROM warehouses AS inv WHERE inv.level = empl.level );
{ "outer_table": "products", "inner_table": "warehouses", "outer_alias": "empl", "inner_alias": "inv", "proj_col": "name", "filter_col": "code", "join_col": "level", "correlated_ref": "empl.level", "token_group": "T2" }
cs8_train_00966
train
T2
v1
Schema: orders (alias: acct)(date, status, name, id) tasks(name, id, salary, status) Task: Select name from orders where code exists in tasks for the same code. SQL:
SELECT name FROM orders AS acct WHERE code IN ( SELECT code FROM tasks AS lne WHERE lne.code = acct.code );
{ "outer_table": "orders", "inner_table": "tasks", "outer_alias": "acct", "inner_alias": "lne", "proj_col": "name", "filter_col": "code", "join_col": "code", "correlated_ref": "acct.code", "token_group": "T1" }
cs8_train_00967
train
T1
v3
Schema: shipments (alias: whs)(amount, value, id, salary) invoices(level, status, code, name) Task: Find name from shipments where amount exceeds the average value from invoices for the same code. SQL:
SELECT name FROM shipments AS whs WHERE amount > ( SELECT COUNT(value) FROM invoices AS cust WHERE cust.code = whs.code );
{ "outer_table": "shipments", "inner_table": "invoices", "outer_alias": "whs", "inner_alias": "cust", "proj_col": "name", "filter_col": "amount", "agg_col": "value", "agg_fn": "COUNT", "join_col": "code", "correlated_ref": "whs.code", "token_group": "T2" }
cs8_train_00968
train
T2
v2
Schema: projects (alias: txn)(name, value, code, amount) suppliers(type, name, date, id) Task: Retrieve name from projects that have at least one corresponding entry in suppliers sharing the same id. SQL:
SELECT name FROM projects AS txn WHERE EXISTS ( SELECT 1 FROM suppliers AS prod WHERE prod.id = txn.id );
{ "outer_table": "projects", "inner_table": "suppliers", "outer_alias": "txn", "inner_alias": "prod", "proj_col": "name", "join_col": "id", "correlated_ref": "txn.id", "token_group": "T1" }
cs8_train_00969
train
T1
v1
Schema: products (alias: schd)(status, id, level, date) accounts(date, level, name, code) Task: Select salary from products where type exists in accounts for the same level. SQL:
SELECT salary FROM products AS schd WHERE type IN ( SELECT type FROM accounts AS lne WHERE lne.level = schd.level );
{ "outer_table": "products", "inner_table": "accounts", "outer_alias": "schd", "inner_alias": "lne", "proj_col": "salary", "filter_col": "type", "join_col": "level", "correlated_ref": "schd.level", "token_group": "T2" }
cs8_train_00970
train
T2
v1
Schema: categories (alias: dept)(level, amount, id, value) regions(level, status, value, code) Task: Retrieve salary from categories whose level is found in regions rows where code matches the outer record. SQL:
SELECT salary FROM categories AS dept WHERE level IN ( SELECT level FROM regions AS txn WHERE txn.code = dept.code );
{ "outer_table": "categories", "inner_table": "regions", "outer_alias": "dept", "inner_alias": "txn", "proj_col": "salary", "filter_col": "level", "join_col": "code", "correlated_ref": "dept.code", "token_group": "T1" }
cs8_train_00971
train
T1
v1
Schema: accounts (alias: srvc)(status, level, id, name) projects(code, id, type, amount) Task: Retrieve name from accounts whose id is found in projects rows where id matches the outer record. SQL:
SELECT name FROM accounts AS srvc WHERE id IN ( SELECT id FROM projects AS cust WHERE cust.id = srvc.id );
{ "outer_table": "accounts", "inner_table": "projects", "outer_alias": "srvc", "inner_alias": "cust", "proj_col": "name", "filter_col": "id", "join_col": "id", "correlated_ref": "srvc.id", "token_group": "T2" }
cs8_train_00972
train
T2
v3
Schema: warehouses (alias: empl)(amount, value, name, code) accounts(name, id, value, level) Task: Find code from warehouses where salary exceeds the average salary from accounts for the same id. SQL:
SELECT code FROM warehouses AS empl WHERE salary > ( SELECT MIN(salary) FROM accounts AS srvc WHERE srvc.id = empl.id );
{ "outer_table": "warehouses", "inner_table": "accounts", "outer_alias": "empl", "inner_alias": "srvc", "proj_col": "code", "filter_col": "salary", "agg_col": "salary", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_train_00973
train
T2
v1
Schema: employees (alias: sale)(amount, code, salary, type) transactions(date, type, amount, code) Task: Find amount from employees where code appears in transactions entries with matching type. SQL:
SELECT amount FROM employees AS sale WHERE code IN ( SELECT code FROM transactions AS ord WHERE ord.type = sale.type );
{ "outer_table": "employees", "inner_table": "transactions", "outer_alias": "sale", "inner_alias": "ord", "proj_col": "amount", "filter_col": "code", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00974
train
T1
v3
Schema: suppliers (alias: budg)(status, id, level, date) tasks(value, salary, name, amount) Task: Find value from suppliers where amount exceeds the average salary from tasks for the same id. SQL:
SELECT value FROM suppliers AS budg WHERE amount > ( SELECT AVG(salary) FROM tasks AS whs WHERE whs.id = budg.id );
{ "outer_table": "suppliers", "inner_table": "tasks", "outer_alias": "budg", "inner_alias": "whs", "proj_col": "value", "filter_col": "amount", "agg_col": "salary", "agg_fn": "AVG", "join_col": "id", "correlated_ref": "budg.id", "token_group": "T2" }
cs8_train_00975
train
T2
v2
Schema: categories (alias: acct)(id, type, date, name) orders(name, id, type, salary) Task: Find id from categories where a matching record exists in orders with the same type. SQL:
SELECT id FROM categories AS acct WHERE EXISTS ( SELECT 1 FROM orders AS whs WHERE whs.type = acct.type );
{ "outer_table": "categories", "inner_table": "orders", "outer_alias": "acct", "inner_alias": "whs", "proj_col": "id", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_train_00976
train
T1
v2
Schema: tasks (alias: catg)(name, date, code, value) regions(status, level, salary, date) Task: Retrieve code from tasks that have at least one corresponding entry in regions sharing the same status. SQL:
SELECT code FROM tasks AS catg WHERE EXISTS ( SELECT 1 FROM regions AS emp WHERE emp.status = catg.status );
{ "outer_table": "tasks", "inner_table": "regions", "outer_alias": "catg", "inner_alias": "emp", "proj_col": "code", "join_col": "status", "correlated_ref": "catg.status", "token_group": "T2" }
cs8_train_00977
train
T2
v2
Schema: transactions (alias: sale)(value, id, amount, status) categories(salary, level, name, amount) Task: Find id from transactions where a matching record exists in categories with the same type. SQL:
SELECT id FROM transactions AS sale WHERE EXISTS ( SELECT 1 FROM categories AS dept WHERE dept.type = sale.type );
{ "outer_table": "transactions", "inner_table": "categories", "outer_alias": "sale", "inner_alias": "dept", "proj_col": "id", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00978
train
T1
v2
Schema: orders (alias: catg)(id, salary, code, date) categories(name, code, id, salary) Task: Find salary from orders where a matching record exists in categories with the same status. SQL:
SELECT salary FROM orders AS catg WHERE EXISTS ( SELECT 1 FROM categories AS acct WHERE acct.status = catg.status );
{ "outer_table": "orders", "inner_table": "categories", "outer_alias": "catg", "inner_alias": "acct", "proj_col": "salary", "join_col": "status", "correlated_ref": "catg.status", "token_group": "T2" }
cs8_train_00979
train
T2
v2
Schema: accounts (alias: ord)(type, code, level, status) shipments(code, date, id, value) Task: Retrieve amount from accounts that have at least one corresponding entry in shipments sharing the same type. SQL:
SELECT amount FROM accounts AS ord WHERE EXISTS ( SELECT 1 FROM shipments AS ordr WHERE ordr.type = ord.type );
{ "outer_table": "accounts", "inner_table": "shipments", "outer_alias": "ord", "inner_alias": "ordr", "proj_col": "amount", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_train_00980
train
T1
v3
Schema: orders (alias: inv)(name, value, type, status) suppliers(level, salary, value, amount) Task: Find code from orders where value exceeds the average salary from suppliers for the same level. SQL:
SELECT code FROM orders AS inv WHERE value > ( SELECT AVG(salary) FROM suppliers AS lne WHERE lne.level = inv.level );
{ "outer_table": "orders", "inner_table": "suppliers", "outer_alias": "inv", "inner_alias": "lne", "proj_col": "code", "filter_col": "value", "agg_col": "salary", "agg_fn": "AVG", "join_col": "level", "correlated_ref": "inv.level", "token_group": "T1" }
cs8_train_00981
train
T1
v3
Schema: suppliers (alias: acct)(code, salary, level, id) accounts(date, status, amount, type) Task: Retrieve value from suppliers with amount above the COUNT(value) of accounts rows sharing the same status. SQL:
SELECT value FROM suppliers AS acct WHERE amount > ( SELECT COUNT(value) FROM accounts AS catg WHERE catg.status = acct.status );
{ "outer_table": "suppliers", "inner_table": "accounts", "outer_alias": "acct", "inner_alias": "catg", "proj_col": "value", "filter_col": "amount", "agg_col": "value", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_train_00982
train
T1
v2
Schema: employees (alias: mgr)(amount, value, name, type) warehouses(date, value, type, id) Task: Retrieve id from employees that have at least one corresponding entry in warehouses sharing the same level. SQL:
SELECT id FROM employees AS mgr WHERE EXISTS ( SELECT 1 FROM warehouses AS acct WHERE acct.level = mgr.level );
{ "outer_table": "employees", "inner_table": "warehouses", "outer_alias": "mgr", "inner_alias": "acct", "proj_col": "id", "join_col": "level", "correlated_ref": "mgr.level", "token_group": "T1" }
cs8_train_00983
train
T1
v1
Schema: regions (alias: inv)(id, name, status, amount) branches(level, value, date, type) Task: Select salary from regions where id exists in branches for the same level. SQL:
SELECT salary FROM regions AS inv WHERE id IN ( SELECT id FROM branches AS prod WHERE prod.level = inv.level );
{ "outer_table": "regions", "inner_table": "branches", "outer_alias": "inv", "inner_alias": "prod", "proj_col": "salary", "filter_col": "id", "join_col": "level", "correlated_ref": "inv.level", "token_group": "T1" }
cs8_train_00984
train
T1
v1
Schema: departments (alias: emp)(id, salary, amount, type) shipments(level, value, code, salary) Task: Select amount from departments where code exists in shipments for the same status. SQL:
SELECT amount FROM departments AS emp WHERE code IN ( SELECT code FROM shipments AS budg WHERE budg.status = emp.status );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "emp", "inner_alias": "budg", "proj_col": "amount", "filter_col": "code", "join_col": "status", "correlated_ref": "emp.status", "token_group": "T1" }
cs8_train_00985
train
T1
v2
Schema: projects (alias: rgn)(date, value, name, salary) tasks(value, name, code, amount) Task: Find name from projects where a matching record exists in tasks with the same id. SQL:
SELECT name FROM projects AS rgn WHERE EXISTS ( SELECT 1 FROM tasks AS dept WHERE dept.id = rgn.id );
{ "outer_table": "projects", "inner_table": "tasks", "outer_alias": "rgn", "inner_alias": "dept", "proj_col": "name", "join_col": "id", "correlated_ref": "rgn.id", "token_group": "T2" }
cs8_train_00986
train
T2
v3
Schema: transactions (alias: cust)(code, name, type, level) departments(amount, name, status, value) Task: Find amount from transactions where value exceeds the average amount from departments for the same code. SQL:
SELECT amount FROM transactions AS cust WHERE value > ( SELECT MIN(amount) FROM departments AS rgn WHERE rgn.code = cust.code );
{ "outer_table": "transactions", "inner_table": "departments", "outer_alias": "cust", "inner_alias": "rgn", "proj_col": "amount", "filter_col": "value", "agg_col": "amount", "agg_fn": "MIN", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_train_00987
train
T1
v2
Schema: shipments (alias: budg)(amount, salary, value, code) transactions(id, name, type, salary) Task: Retrieve code from shipments that have at least one corresponding entry in transactions sharing the same type. SQL:
SELECT code FROM shipments AS budg WHERE EXISTS ( SELECT 1 FROM transactions AS prod WHERE prod.type = budg.type );
{ "outer_table": "shipments", "inner_table": "transactions", "outer_alias": "budg", "inner_alias": "prod", "proj_col": "code", "join_col": "type", "correlated_ref": "budg.type", "token_group": "T2" }
cs8_train_00988
train
T2
v1
Schema: regions (alias: mgr)(amount, id, salary, level) suppliers(name, status, date, code) Task: Retrieve id from regions whose level is found in suppliers rows where code matches the outer record. SQL:
SELECT id FROM regions AS mgr WHERE level IN ( SELECT level FROM suppliers AS srvc WHERE srvc.code = mgr.code );
{ "outer_table": "regions", "inner_table": "suppliers", "outer_alias": "mgr", "inner_alias": "srvc", "proj_col": "id", "filter_col": "level", "join_col": "code", "correlated_ref": "mgr.code", "token_group": "T1" }
cs8_train_00989
train
T1
v2
Schema: projects (alias: sale)(name, id, type, date) employees(type, name, code, id) Task: Find amount from projects where a matching record exists in employees with the same id. SQL:
SELECT amount FROM projects AS sale WHERE EXISTS ( SELECT 1 FROM employees AS rgn WHERE rgn.id = sale.id );
{ "outer_table": "projects", "inner_table": "employees", "outer_alias": "sale", "inner_alias": "rgn", "proj_col": "amount", "join_col": "id", "correlated_ref": "sale.id", "token_group": "T1" }
cs8_train_00990
train
T1
v1
Schema: accounts (alias: ord)(name, level, id, salary) employees(salary, value, level, id) Task: Find code from accounts where id appears in employees entries with matching type. SQL:
SELECT code FROM accounts AS ord WHERE id IN ( SELECT id FROM employees AS lne WHERE lne.type = ord.type );
{ "outer_table": "accounts", "inner_table": "employees", "outer_alias": "ord", "inner_alias": "lne", "proj_col": "code", "filter_col": "id", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_train_00991
train
T1
v1
Schema: products (alias: prod)(amount, value, date, code) projects(type, date, value, amount) Task: Find id from products where type appears in projects entries with matching status. SQL:
SELECT id FROM products AS prod WHERE type IN ( SELECT type FROM projects AS cust WHERE cust.status = prod.status );
{ "outer_table": "products", "inner_table": "projects", "outer_alias": "prod", "inner_alias": "cust", "proj_col": "id", "filter_col": "type", "join_col": "status", "correlated_ref": "prod.status", "token_group": "T1" }
cs8_train_00992
train
T1
v2
Schema: departments (alias: prod)(code, date, amount, level) orders(amount, level, type, id) Task: Retrieve value from departments that have at least one corresponding entry in orders sharing the same level. SQL:
SELECT value FROM departments AS prod WHERE EXISTS ( SELECT 1 FROM orders AS txn WHERE txn.level = prod.level );
{ "outer_table": "departments", "inner_table": "orders", "outer_alias": "prod", "inner_alias": "txn", "proj_col": "value", "join_col": "level", "correlated_ref": "prod.level", "token_group": "T1" }
cs8_train_00993
train
T1
v1
Schema: branches (alias: mgr)(salary, value, amount, type) suppliers(code, name, salary, date) Task: Select code from branches where level exists in suppliers for the same id. SQL:
SELECT code FROM branches AS mgr WHERE level IN ( SELECT level FROM suppliers AS ordr WHERE ordr.id = mgr.id );
{ "outer_table": "branches", "inner_table": "suppliers", "outer_alias": "mgr", "inner_alias": "ordr", "proj_col": "code", "filter_col": "level", "join_col": "id", "correlated_ref": "mgr.id", "token_group": "T1" }
cs8_train_00994
train
T1
v3
Schema: projects (alias: emp)(id, type, salary, code) products(salary, id, level, code) Task: Retrieve amount from projects with amount above the SUM(value) of products rows sharing the same code. SQL:
SELECT amount FROM projects AS emp WHERE amount > ( SELECT SUM(value) FROM products AS acct WHERE acct.code = emp.code );
{ "outer_table": "projects", "inner_table": "products", "outer_alias": "emp", "inner_alias": "acct", "proj_col": "amount", "filter_col": "amount", "agg_col": "value", "agg_fn": "SUM", "join_col": "code", "correlated_ref": "emp.code", "token_group": "T1" }
cs8_train_00995
train
T1
v2
Schema: invoices (alias: shp)(amount, type, level, salary) projects(date, value, id, type) Task: Retrieve value from invoices that have at least one corresponding entry in projects sharing the same code. SQL:
SELECT value FROM invoices AS shp WHERE EXISTS ( SELECT 1 FROM projects AS srvc WHERE srvc.code = shp.code );
{ "outer_table": "invoices", "inner_table": "projects", "outer_alias": "shp", "inner_alias": "srvc", "proj_col": "value", "join_col": "code", "correlated_ref": "shp.code", "token_group": "T2" }
cs8_train_00996
train
T2
v1
Schema: branches (alias: empl)(date, level, amount, code) orders(level, code, type, status) Task: Find salary from branches where status appears in orders entries with matching level. SQL:
SELECT salary FROM branches AS empl WHERE status IN ( SELECT status FROM orders AS acct WHERE acct.level = empl.level );
{ "outer_table": "branches", "inner_table": "orders", "outer_alias": "empl", "inner_alias": "acct", "proj_col": "salary", "filter_col": "status", "join_col": "level", "correlated_ref": "empl.level", "token_group": "T2" }
cs8_train_00997
train
T2
v1
Schema: shipments (alias: cust)(amount, date, code, id) transactions(salary, level, status, date) Task: Find amount from shipments where type appears in transactions entries with matching level. SQL:
SELECT amount FROM shipments AS cust WHERE type IN ( SELECT type FROM transactions AS srvc WHERE srvc.level = cust.level );
{ "outer_table": "shipments", "inner_table": "transactions", "outer_alias": "cust", "inner_alias": "srvc", "proj_col": "amount", "filter_col": "type", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_train_00998
train
T1
v1
Schema: regions (alias: srvc)(value, amount, code, type) shipments(value, id, status, level) Task: Select value from regions where type exists in shipments for the same status. SQL:
SELECT value FROM regions AS srvc WHERE type IN ( SELECT type FROM shipments AS budg WHERE budg.status = srvc.status );
{ "outer_table": "regions", "inner_table": "shipments", "outer_alias": "srvc", "inner_alias": "budg", "proj_col": "value", "filter_col": "type", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00999
train
T2