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: departments (alias: emp)(id, level, status, salary) products(salary, type, level, name) Task: Select salary from departments where code exists in products for the same type. SQL:
SELECT salary FROM departments AS emp WHERE code IN ( SELECT code FROM products AS ordr WHERE ordr.type = emp.type );
{ "outer_table": "departments", "inner_table": "products", "outer_alias": "emp", "inner_alias": "ordr", "proj_col": "salary", "filter_col": "code", "join_col": "type", "correlated_ref": "emp.type", "token_group": "T1" }
cs8_train_00300
train
T1
v3
Schema: transactions (alias: sale)(value, id, name, amount) warehouses(id, amount, type, salary) Task: Find amount from transactions where salary exceeds the average amount from warehouses for the same status. SQL:
SELECT amount FROM transactions AS sale WHERE salary > ( SELECT MAX(amount) FROM warehouses AS ordr WHERE ordr.status = sale.status );
{ "outer_table": "transactions", "inner_table": "warehouses", "outer_alias": "sale", "inner_alias": "ordr", "proj_col": "amount", "filter_col": "salary", "agg_col": "amount", "agg_fn": "MAX", "join_col": "status", "correlated_ref": "sale.status", "token_group": "T1" }
cs8_train_00301
train
T1
v3
Schema: shipments (alias: inv)(salary, date, id, level) warehouses(name, amount, code, type) Task: Find name from shipments where value exceeds the average amount from warehouses for the same code. SQL:
SELECT name FROM shipments AS inv WHERE value > ( SELECT MAX(amount) FROM warehouses AS srvc WHERE srvc.code = inv.code );
{ "outer_table": "shipments", "inner_table": "warehouses", "outer_alias": "inv", "inner_alias": "srvc", "proj_col": "name", "filter_col": "value", "agg_col": "amount", "agg_fn": "MAX", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00302
train
T1
v1
Schema: transactions (alias: budg)(status, amount, salary, id) tasks(salary, value, id, level) Task: Find code from transactions where level appears in tasks entries with matching level. SQL:
SELECT code FROM transactions AS budg WHERE level IN ( SELECT level FROM tasks AS shp WHERE shp.level = budg.level );
{ "outer_table": "transactions", "inner_table": "tasks", "outer_alias": "budg", "inner_alias": "shp", "proj_col": "code", "filter_col": "level", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00303
train
T2
v2
Schema: transactions (alias: schd)(name, type, id, level) invoices(level, salary, code, date) Task: Find value from transactions where a matching record exists in invoices with the same type. SQL:
SELECT value FROM transactions AS schd WHERE EXISTS ( SELECT 1 FROM invoices AS lne WHERE lne.type = schd.type );
{ "outer_table": "transactions", "inner_table": "invoices", "outer_alias": "schd", "inner_alias": "lne", "proj_col": "value", "join_col": "type", "correlated_ref": "schd.type", "token_group": "T2" }
cs8_train_00304
train
T2
v1
Schema: branches (alias: txn)(type, value, status, amount) warehouses(code, name, date, level) Task: Find code from branches where level appears in warehouses entries with matching level. SQL:
SELECT code FROM branches AS txn WHERE level IN ( SELECT level FROM warehouses AS prod WHERE prod.level = txn.level );
{ "outer_table": "branches", "inner_table": "warehouses", "outer_alias": "txn", "inner_alias": "prod", "proj_col": "code", "filter_col": "level", "join_col": "level", "correlated_ref": "txn.level", "token_group": "T1" }
cs8_train_00305
train
T1
v3
Schema: warehouses (alias: sale)(code, id, value, status) shipments(date, name, status, type) Task: Find amount from warehouses where value exceeds the average amount from shipments for the same type. SQL:
SELECT amount FROM warehouses AS sale WHERE value > ( SELECT AVG(amount) FROM shipments AS whs WHERE whs.type = sale.type );
{ "outer_table": "warehouses", "inner_table": "shipments", "outer_alias": "sale", "inner_alias": "whs", "proj_col": "amount", "filter_col": "value", "agg_col": "amount", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00306
train
T1
v1
Schema: transactions (alias: ord)(status, amount, code, id) projects(id, type, status, date) Task: Find amount from transactions where code appears in projects entries with matching type. SQL:
SELECT amount FROM transactions AS ord WHERE code IN ( SELECT code FROM projects AS cust WHERE cust.type = ord.type );
{ "outer_table": "transactions", "inner_table": "projects", "outer_alias": "ord", "inner_alias": "cust", "proj_col": "amount", "filter_col": "code", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_train_00307
train
T1
v3
Schema: suppliers (alias: dept)(code, id, type, status) departments(code, date, salary, type) Task: Retrieve code from suppliers with value above the AVG(salary) of departments rows sharing the same id. SQL:
SELECT code FROM suppliers AS dept WHERE value > ( SELECT AVG(salary) FROM departments AS srvc WHERE srvc.id = dept.id );
{ "outer_table": "suppliers", "inner_table": "departments", "outer_alias": "dept", "inner_alias": "srvc", "proj_col": "code", "filter_col": "value", "agg_col": "salary", "agg_fn": "AVG", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00308
train
T1
v1
Schema: warehouses (alias: dept)(level, status, code, type) shipments(code, salary, type, value) Task: Find value from warehouses where status appears in shipments entries with matching status. SQL:
SELECT value FROM warehouses AS dept WHERE status IN ( SELECT status FROM shipments AS inv WHERE inv.status = dept.status );
{ "outer_table": "warehouses", "inner_table": "shipments", "outer_alias": "dept", "inner_alias": "inv", "proj_col": "value", "filter_col": "status", "join_col": "status", "correlated_ref": "dept.status", "token_group": "T1" }
cs8_train_00309
train
T1
v2
Schema: employees (alias: mgr)(type, date, level, value) accounts(id, level, name, amount) Task: Find code from employees where a matching record exists in accounts with the same id. SQL:
SELECT code FROM employees AS mgr WHERE EXISTS ( SELECT 1 FROM accounts AS shp WHERE shp.id = mgr.id );
{ "outer_table": "employees", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "shp", "proj_col": "code", "join_col": "id", "correlated_ref": "mgr.id", "token_group": "T1" }
cs8_train_00310
train
T1
v3
Schema: tasks (alias: acct)(id, salary, name, value) shipments(value, code, status, id) Task: Retrieve amount from tasks with amount above the AVG(value) of shipments rows sharing the same type. SQL:
SELECT amount FROM tasks AS acct WHERE amount > ( SELECT AVG(value) FROM shipments AS lne WHERE lne.type = acct.type );
{ "outer_table": "tasks", "inner_table": "shipments", "outer_alias": "acct", "inner_alias": "lne", "proj_col": "amount", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_train_00311
train
T1
v1
Schema: suppliers (alias: sale)(amount, value, date, type) products(name, date, status, amount) Task: Find id from suppliers where type appears in products entries with matching level. SQL:
SELECT id FROM suppliers AS sale WHERE type IN ( SELECT type FROM products AS whs WHERE whs.level = sale.level );
{ "outer_table": "suppliers", "inner_table": "products", "outer_alias": "sale", "inner_alias": "whs", "proj_col": "id", "filter_col": "type", "join_col": "level", "correlated_ref": "sale.level", "token_group": "T1" }
cs8_train_00312
train
T1
v1
Schema: orders (alias: srvc)(level, date, type, value) categories(date, amount, value, salary) Task: Select name from orders where level exists in categories for the same level. SQL:
SELECT name FROM orders AS srvc WHERE level IN ( SELECT level FROM categories AS schd WHERE schd.level = srvc.level );
{ "outer_table": "orders", "inner_table": "categories", "outer_alias": "srvc", "inner_alias": "schd", "proj_col": "name", "filter_col": "level", "join_col": "level", "correlated_ref": "srvc.level", "token_group": "T2" }
cs8_train_00313
train
T2
v1
Schema: warehouses (alias: emp)(date, status, name, salary) invoices(type, salary, amount, code) Task: Find amount from warehouses where level appears in invoices entries with matching type. SQL:
SELECT amount FROM warehouses AS emp WHERE level IN ( SELECT level FROM invoices AS budg WHERE budg.type = emp.type );
{ "outer_table": "warehouses", "inner_table": "invoices", "outer_alias": "emp", "inner_alias": "budg", "proj_col": "amount", "filter_col": "level", "join_col": "type", "correlated_ref": "emp.type", "token_group": "T1" }
cs8_train_00314
train
T1
v1
Schema: regions (alias: dept)(amount, id, date, type) categories(value, salary, date, level) Task: Select amount from regions where status exists in categories for the same id. SQL:
SELECT amount FROM regions AS dept WHERE status IN ( SELECT status FROM categories AS prod WHERE prod.id = dept.id );
{ "outer_table": "regions", "inner_table": "categories", "outer_alias": "dept", "inner_alias": "prod", "proj_col": "amount", "filter_col": "status", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00315
train
T1
v3
Schema: projects (alias: shp)(date, type, level, code) suppliers(name, value, amount, level) Task: Find id from projects where salary exceeds the average value from suppliers for the same id. SQL:
SELECT id FROM projects AS shp WHERE salary > ( SELECT SUM(value) FROM suppliers AS txn WHERE txn.id = shp.id );
{ "outer_table": "projects", "inner_table": "suppliers", "outer_alias": "shp", "inner_alias": "txn", "proj_col": "id", "filter_col": "salary", "agg_col": "value", "agg_fn": "SUM", "join_col": "id", "correlated_ref": "shp.id", "token_group": "T2" }
cs8_train_00316
train
T2
v3
Schema: shipments (alias: mgr)(status, type, id, code) employees(date, value, id, salary) Task: Retrieve code from shipments with value above the MAX(salary) of employees rows sharing the same status. SQL:
SELECT code FROM shipments AS mgr WHERE value > ( SELECT MAX(salary) FROM employees AS prod WHERE prod.status = mgr.status );
{ "outer_table": "shipments", "inner_table": "employees", "outer_alias": "mgr", "inner_alias": "prod", "proj_col": "code", "filter_col": "value", "agg_col": "salary", "agg_fn": "MAX", "join_col": "status", "correlated_ref": "mgr.status", "token_group": "T1" }
cs8_train_00317
train
T1
v3
Schema: branches (alias: budg)(id, name, level, code) employees(status, value, name, id) Task: Find amount from branches where amount exceeds the average value from employees for the same type. SQL:
SELECT amount FROM branches AS budg WHERE amount > ( SELECT SUM(value) FROM employees AS dept WHERE dept.type = budg.type );
{ "outer_table": "branches", "inner_table": "employees", "outer_alias": "budg", "inner_alias": "dept", "proj_col": "amount", "filter_col": "amount", "agg_col": "value", "agg_fn": "SUM", "join_col": "type", "correlated_ref": "budg.type", "token_group": "T2" }
cs8_train_00318
train
T2
v3
Schema: customers (alias: mgr)(code, name, level, status) accounts(amount, code, value, type) Task: Retrieve amount from customers with value above the AVG(value) of accounts rows sharing the same type. SQL:
SELECT amount FROM customers AS mgr WHERE value > ( SELECT AVG(value) FROM accounts AS whs WHERE whs.type = mgr.type );
{ "outer_table": "customers", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "whs", "proj_col": "amount", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "mgr.type", "token_group": "T1" }
cs8_train_00319
train
T1
v2
Schema: departments (alias: sale)(salary, level, amount, type) invoices(salary, status, date, amount) Task: Find name from departments where a matching record exists in invoices with the same code. SQL:
SELECT name FROM departments AS sale WHERE EXISTS ( SELECT 1 FROM invoices AS srvc WHERE srvc.code = sale.code );
{ "outer_table": "departments", "inner_table": "invoices", "outer_alias": "sale", "inner_alias": "srvc", "proj_col": "name", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00320
train
T1
v3
Schema: suppliers (alias: cust)(date, amount, code, value) regions(code, status, id, name) Task: Find name from suppliers where amount exceeds the average amount from regions for the same level. SQL:
SELECT name FROM suppliers AS cust WHERE amount > ( SELECT AVG(amount) FROM regions AS rgn WHERE rgn.level = cust.level );
{ "outer_table": "suppliers", "inner_table": "regions", "outer_alias": "cust", "inner_alias": "rgn", "proj_col": "name", "filter_col": "amount", "agg_col": "amount", "agg_fn": "AVG", "join_col": "level", "correlated_ref": "cust.level", "token_group": "T1" }
cs8_train_00321
train
T1
v3
Schema: departments (alias: empl)(value, id, date, name) orders(status, amount, code, date) Task: Retrieve salary from departments with salary above the COUNT(salary) of orders rows sharing the same id. SQL:
SELECT salary FROM departments AS empl WHERE salary > ( SELECT COUNT(salary) FROM orders AS lne WHERE lne.id = empl.id );
{ "outer_table": "departments", "inner_table": "orders", "outer_alias": "empl", "inner_alias": "lne", "proj_col": "salary", "filter_col": "salary", "agg_col": "salary", "agg_fn": "COUNT", "join_col": "id", "correlated_ref": "empl.id", "token_group": "T2" }
cs8_train_00322
train
T2
v3
Schema: warehouses (alias: sale)(date, level, value, salary) accounts(value, status, id, amount) Task: Find salary from warehouses where amount exceeds the average value from accounts for the same status. SQL:
SELECT salary FROM warehouses AS sale WHERE amount > ( SELECT AVG(value) FROM accounts AS inv WHERE inv.status = sale.status );
{ "outer_table": "warehouses", "inner_table": "accounts", "outer_alias": "sale", "inner_alias": "inv", "proj_col": "salary", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "sale.status", "token_group": "T1" }
cs8_train_00323
train
T1
v1
Schema: departments (alias: schd)(date, level, id, salary) accounts(amount, id, type, value) Task: Find salary from departments where status appears in accounts entries with matching type. SQL:
SELECT salary FROM departments AS schd WHERE status IN ( SELECT status FROM accounts AS empl WHERE empl.type = schd.type );
{ "outer_table": "departments", "inner_table": "accounts", "outer_alias": "schd", "inner_alias": "empl", "proj_col": "salary", "filter_col": "status", "join_col": "type", "correlated_ref": "schd.type", "token_group": "T2" }
cs8_train_00324
train
T2
v2
Schema: customers (alias: budg)(type, value, salary, date) branches(type, status, salary, name) Task: Find id from customers where a matching record exists in branches with the same level. SQL:
SELECT id FROM customers AS budg WHERE EXISTS ( SELECT 1 FROM branches AS dept WHERE dept.level = budg.level );
{ "outer_table": "customers", "inner_table": "branches", "outer_alias": "budg", "inner_alias": "dept", "proj_col": "id", "join_col": "level", "correlated_ref": "budg.level", "token_group": "T2" }
cs8_train_00325
train
T2
v2
Schema: departments (alias: budg)(date, status, value, name) tasks(code, value, name, level) Task: Find name from departments where a matching record exists in tasks with the same id. SQL:
SELECT name FROM departments AS budg WHERE EXISTS ( SELECT 1 FROM tasks AS prod WHERE prod.id = budg.id );
{ "outer_table": "departments", "inner_table": "tasks", "outer_alias": "budg", "inner_alias": "prod", "proj_col": "name", "join_col": "id", "correlated_ref": "budg.id", "token_group": "T2" }
cs8_train_00326
train
T2
v2
Schema: departments (alias: mgr)(level, id, status, type) transactions(amount, value, code, type) Task: Find id from departments where a matching record exists in transactions with the same level. SQL:
SELECT id FROM departments AS mgr WHERE EXISTS ( SELECT 1 FROM transactions AS inv WHERE inv.level = mgr.level );
{ "outer_table": "departments", "inner_table": "transactions", "outer_alias": "mgr", "inner_alias": "inv", "proj_col": "id", "join_col": "level", "correlated_ref": "mgr.level", "token_group": "T1" }
cs8_train_00327
train
T1
v3
Schema: shipments (alias: lne)(amount, name, level, type) tasks(date, id, amount, level) Task: Find value from shipments where amount exceeds the average amount from tasks for the same id. SQL:
SELECT value FROM shipments AS lne WHERE amount > ( SELECT MIN(amount) FROM tasks AS shp WHERE shp.id = lne.id );
{ "outer_table": "shipments", "inner_table": "tasks", "outer_alias": "lne", "inner_alias": "shp", "proj_col": "value", "filter_col": "amount", "agg_col": "amount", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_train_00328
train
T2
v1
Schema: departments (alias: lne)(salary, name, amount, id) invoices(code, amount, level, name) Task: Select amount from departments where level exists in invoices for the same level. SQL:
SELECT amount FROM departments AS lne WHERE level IN ( SELECT level FROM invoices AS inv WHERE inv.level = lne.level );
{ "outer_table": "departments", "inner_table": "invoices", "outer_alias": "lne", "inner_alias": "inv", "proj_col": "amount", "filter_col": "level", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_train_00329
train
T2
v3
Schema: regions (alias: whs)(value, name, type, salary) suppliers(level, code, salary, amount) Task: Retrieve salary from regions with amount above the MAX(value) of suppliers rows sharing the same id. SQL:
SELECT salary FROM regions AS whs WHERE amount > ( SELECT MAX(value) FROM suppliers AS sale WHERE sale.id = whs.id );
{ "outer_table": "regions", "inner_table": "suppliers", "outer_alias": "whs", "inner_alias": "sale", "proj_col": "salary", "filter_col": "amount", "agg_col": "value", "agg_fn": "MAX", "join_col": "id", "correlated_ref": "whs.id", "token_group": "T2" }
cs8_train_00330
train
T2
v1
Schema: accounts (alias: whs)(code, name, id, value) orders(salary, status, name, amount) Task: Retrieve salary from accounts whose code is found in orders rows where type matches the outer record. SQL:
SELECT salary FROM accounts AS whs WHERE code IN ( SELECT code FROM orders AS emp WHERE emp.type = whs.type );
{ "outer_table": "accounts", "inner_table": "orders", "outer_alias": "whs", "inner_alias": "emp", "proj_col": "salary", "filter_col": "code", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00331
train
T2
v2
Schema: tasks (alias: inv)(value, salary, id, type) transactions(status, salary, level, amount) Task: Find name from tasks where a matching record exists in transactions with the same status. SQL:
SELECT name FROM tasks AS inv WHERE EXISTS ( SELECT 1 FROM transactions AS ord WHERE ord.status = inv.status );
{ "outer_table": "tasks", "inner_table": "transactions", "outer_alias": "inv", "inner_alias": "ord", "proj_col": "name", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_train_00332
train
T1
v2
Schema: orders (alias: schd)(code, level, salary, name) warehouses(name, id, level, salary) Task: Find name from orders where a matching record exists in warehouses with the same code. SQL:
SELECT name FROM orders AS schd WHERE EXISTS ( SELECT 1 FROM warehouses AS whs WHERE whs.code = schd.code );
{ "outer_table": "orders", "inner_table": "warehouses", "outer_alias": "schd", "inner_alias": "whs", "proj_col": "name", "join_col": "code", "correlated_ref": "schd.code", "token_group": "T2" }
cs8_train_00333
train
T2
v2
Schema: tasks (alias: txn)(level, value, status, code) shipments(id, level, name, status) Task: Retrieve code from tasks that have at least one corresponding entry in shipments sharing the same type. SQL:
SELECT code FROM tasks AS txn WHERE EXISTS ( SELECT 1 FROM shipments AS prod WHERE prod.type = txn.type );
{ "outer_table": "tasks", "inner_table": "shipments", "outer_alias": "txn", "inner_alias": "prod", "proj_col": "code", "join_col": "type", "correlated_ref": "txn.type", "token_group": "T1" }
cs8_train_00334
train
T1
v1
Schema: projects (alias: ord)(name, level, value, type) shipments(salary, status, value, level) Task: Retrieve salary from projects whose id is found in shipments rows where status matches the outer record. SQL:
SELECT salary FROM projects AS ord WHERE id IN ( SELECT id FROM shipments AS srvc WHERE srvc.status = ord.status );
{ "outer_table": "projects", "inner_table": "shipments", "outer_alias": "ord", "inner_alias": "srvc", "proj_col": "salary", "filter_col": "id", "join_col": "status", "correlated_ref": "ord.status", "token_group": "T1" }
cs8_train_00335
train
T1
v3
Schema: customers (alias: ordr)(salary, level, code, name) tasks(status, code, date, id) Task: Retrieve amount from customers with amount above the MIN(amount) of tasks rows sharing the same type. SQL:
SELECT amount FROM customers AS ordr WHERE amount > ( SELECT MIN(amount) FROM tasks AS dept WHERE dept.type = ordr.type );
{ "outer_table": "customers", "inner_table": "tasks", "outer_alias": "ordr", "inner_alias": "dept", "proj_col": "amount", "filter_col": "amount", "agg_col": "amount", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "ordr.type", "token_group": "T2" }
cs8_train_00336
train
T2
v1
Schema: transactions (alias: dept)(code, amount, value, salary) products(salary, level, code, id) Task: Find code from transactions where status appears in products entries with matching type. SQL:
SELECT code FROM transactions AS dept WHERE status IN ( SELECT status FROM products AS srvc WHERE srvc.type = dept.type );
{ "outer_table": "transactions", "inner_table": "products", "outer_alias": "dept", "inner_alias": "srvc", "proj_col": "code", "filter_col": "status", "join_col": "type", "correlated_ref": "dept.type", "token_group": "T1" }
cs8_train_00337
train
T1
v2
Schema: invoices (alias: dept)(status, date, salary, name) categories(status, salary, type, date) Task: Find code from invoices where a matching record exists in categories with the same id. SQL:
SELECT code FROM invoices AS dept WHERE EXISTS ( SELECT 1 FROM categories AS ord WHERE ord.id = dept.id );
{ "outer_table": "invoices", "inner_table": "categories", "outer_alias": "dept", "inner_alias": "ord", "proj_col": "code", "join_col": "id", "correlated_ref": "dept.id", "token_group": "T1" }
cs8_train_00338
train
T1
v2
Schema: shipments (alias: whs)(type, salary, level, name) categories(level, id, salary, name) Task: Find amount from shipments where a matching record exists in categories with the same id. SQL:
SELECT amount FROM shipments AS whs WHERE EXISTS ( SELECT 1 FROM categories AS catg WHERE catg.id = whs.id );
{ "outer_table": "shipments", "inner_table": "categories", "outer_alias": "whs", "inner_alias": "catg", "proj_col": "amount", "join_col": "id", "correlated_ref": "whs.id", "token_group": "T2" }
cs8_train_00339
train
T2
v1
Schema: shipments (alias: whs)(status, name, salary, type) transactions(value, code, date, level) Task: Select code from shipments where id exists in transactions for the same id. SQL:
SELECT code FROM shipments AS whs WHERE id IN ( SELECT id FROM transactions AS shp WHERE shp.id = whs.id );
{ "outer_table": "shipments", "inner_table": "transactions", "outer_alias": "whs", "inner_alias": "shp", "proj_col": "code", "filter_col": "id", "join_col": "id", "correlated_ref": "whs.id", "token_group": "T2" }
cs8_train_00340
train
T2
v2
Schema: employees (alias: ord)(date, code, salary, type) products(level, date, salary, status) Task: Find code from employees where a matching record exists in products with the same type. SQL:
SELECT code FROM employees AS ord WHERE EXISTS ( SELECT 1 FROM products AS shp WHERE shp.type = ord.type );
{ "outer_table": "employees", "inner_table": "products", "outer_alias": "ord", "inner_alias": "shp", "proj_col": "code", "join_col": "type", "correlated_ref": "ord.type", "token_group": "T1" }
cs8_train_00341
train
T1
v3
Schema: departments (alias: whs)(status, salary, id, level) warehouses(status, salary, amount, level) Task: Retrieve id from departments with salary above the MIN(salary) of warehouses rows sharing the same level. SQL:
SELECT id FROM departments AS whs WHERE salary > ( SELECT MIN(salary) FROM warehouses AS mgr WHERE mgr.level = whs.level );
{ "outer_table": "departments", "inner_table": "warehouses", "outer_alias": "whs", "inner_alias": "mgr", "proj_col": "id", "filter_col": "salary", "agg_col": "salary", "agg_fn": "MIN", "join_col": "level", "correlated_ref": "whs.level", "token_group": "T2" }
cs8_train_00342
train
T2
v2
Schema: suppliers (alias: sale)(type, salary, date, status) projects(code, date, salary, level) Task: Retrieve value from suppliers that have at least one corresponding entry in projects sharing the same code. SQL:
SELECT value FROM suppliers AS sale WHERE EXISTS ( SELECT 1 FROM projects AS schd WHERE schd.code = sale.code );
{ "outer_table": "suppliers", "inner_table": "projects", "outer_alias": "sale", "inner_alias": "schd", "proj_col": "value", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00343
train
T1
v1
Schema: departments (alias: ordr)(type, level, value, id) regions(date, id, value, code) Task: Select salary from departments where status exists in regions for the same status. SQL:
SELECT salary FROM departments AS ordr WHERE status IN ( SELECT status FROM regions AS mgr WHERE mgr.status = ordr.status );
{ "outer_table": "departments", "inner_table": "regions", "outer_alias": "ordr", "inner_alias": "mgr", "proj_col": "salary", "filter_col": "status", "join_col": "status", "correlated_ref": "ordr.status", "token_group": "T2" }
cs8_train_00344
train
T2
v1
Schema: branches (alias: budg)(id, name, value, date) projects(type, value, status, level) Task: Retrieve id from branches whose id is found in projects rows where code matches the outer record. SQL:
SELECT id FROM branches AS budg WHERE id IN ( SELECT id FROM projects AS cust WHERE cust.code = budg.code );
{ "outer_table": "branches", "inner_table": "projects", "outer_alias": "budg", "inner_alias": "cust", "proj_col": "id", "filter_col": "id", "join_col": "code", "correlated_ref": "budg.code", "token_group": "T2" }
cs8_train_00345
train
T2
v3
Schema: departments (alias: acct)(name, type, code, id) products(level, name, type, date) Task: Retrieve code from departments with salary above the MIN(value) of products rows sharing the same status. SQL:
SELECT code FROM departments AS acct WHERE salary > ( SELECT MIN(value) FROM products AS empl WHERE empl.status = acct.status );
{ "outer_table": "departments", "inner_table": "products", "outer_alias": "acct", "inner_alias": "empl", "proj_col": "code", "filter_col": "salary", "agg_col": "value", "agg_fn": "MIN", "join_col": "status", "correlated_ref": "acct.status", "token_group": "T1" }
cs8_train_00346
train
T1
v1
Schema: products (alias: lne)(date, status, amount, value) invoices(code, type, salary, amount) Task: Find amount from products where id appears in invoices entries with matching level. SQL:
SELECT amount FROM products AS lne WHERE id IN ( SELECT id FROM invoices AS emp WHERE emp.level = lne.level );
{ "outer_table": "products", "inner_table": "invoices", "outer_alias": "lne", "inner_alias": "emp", "proj_col": "amount", "filter_col": "id", "join_col": "level", "correlated_ref": "lne.level", "token_group": "T2" }
cs8_train_00347
train
T2
v1
Schema: transactions (alias: emp)(name, value, salary, code) employees(amount, salary, level, status) Task: Retrieve amount from transactions whose level is found in employees rows where type matches the outer record. SQL:
SELECT amount FROM transactions AS emp WHERE level IN ( SELECT level FROM employees AS srvc WHERE srvc.type = emp.type );
{ "outer_table": "transactions", "inner_table": "employees", "outer_alias": "emp", "inner_alias": "srvc", "proj_col": "amount", "filter_col": "level", "join_col": "type", "correlated_ref": "emp.type", "token_group": "T1" }
cs8_train_00348
train
T1
v2
Schema: invoices (alias: rgn)(amount, id, level, type) suppliers(type, name, code, status) Task: Find salary from invoices where a matching record exists in suppliers with the same code. SQL:
SELECT salary FROM invoices AS rgn WHERE EXISTS ( SELECT 1 FROM suppliers AS whs WHERE whs.code = rgn.code );
{ "outer_table": "invoices", "inner_table": "suppliers", "outer_alias": "rgn", "inner_alias": "whs", "proj_col": "salary", "join_col": "code", "correlated_ref": "rgn.code", "token_group": "T2" }
cs8_train_00349
train
T2
v2
Schema: transactions (alias: schd)(name, id, level, status) shipments(amount, code, date, status) Task: Find name from transactions where a matching record exists in shipments with the same type. SQL:
SELECT name FROM transactions AS schd WHERE EXISTS ( SELECT 1 FROM shipments AS inv WHERE inv.type = schd.type );
{ "outer_table": "transactions", "inner_table": "shipments", "outer_alias": "schd", "inner_alias": "inv", "proj_col": "name", "join_col": "type", "correlated_ref": "schd.type", "token_group": "T2" }
cs8_train_00350
train
T2
v1
Schema: warehouses (alias: dept)(code, name, type, value) customers(salary, type, amount, date) Task: Find salary from warehouses where status appears in customers entries with matching status. SQL:
SELECT salary FROM warehouses AS dept WHERE status IN ( SELECT status FROM customers AS emp WHERE emp.status = dept.status );
{ "outer_table": "warehouses", "inner_table": "customers", "outer_alias": "dept", "inner_alias": "emp", "proj_col": "salary", "filter_col": "status", "join_col": "status", "correlated_ref": "dept.status", "token_group": "T1" }
cs8_train_00351
train
T1
v1
Schema: invoices (alias: dept)(value, code, status, name) tasks(id, name, value, amount) Task: Retrieve amount from invoices whose type is found in tasks rows where status matches the outer record. SQL:
SELECT amount FROM invoices AS dept WHERE type IN ( SELECT type FROM tasks AS srvc WHERE srvc.status = dept.status );
{ "outer_table": "invoices", "inner_table": "tasks", "outer_alias": "dept", "inner_alias": "srvc", "proj_col": "amount", "filter_col": "type", "join_col": "status", "correlated_ref": "dept.status", "token_group": "T1" }
cs8_train_00352
train
T1
v1
Schema: categories (alias: acct)(date, code, type, level) customers(code, id, amount, name) Task: Find code from categories where type appears in customers entries with matching code. SQL:
SELECT code FROM categories AS acct WHERE type IN ( SELECT type FROM customers AS txn WHERE txn.code = acct.code );
{ "outer_table": "categories", "inner_table": "customers", "outer_alias": "acct", "inner_alias": "txn", "proj_col": "code", "filter_col": "type", "join_col": "code", "correlated_ref": "acct.code", "token_group": "T1" }
cs8_train_00353
train
T1
v1
Schema: invoices (alias: srvc)(code, amount, value, date) suppliers(id, date, name, status) Task: Select value from invoices where status exists in suppliers for the same status. SQL:
SELECT value FROM invoices AS srvc WHERE status IN ( SELECT status FROM suppliers AS emp WHERE emp.status = srvc.status );
{ "outer_table": "invoices", "inner_table": "suppliers", "outer_alias": "srvc", "inner_alias": "emp", "proj_col": "value", "filter_col": "status", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00354
train
T2
v2
Schema: projects (alias: sale)(value, id, level, type) accounts(status, value, type, level) Task: Find name from projects where a matching record exists in accounts with the same code. SQL:
SELECT name FROM projects AS sale WHERE EXISTS ( SELECT 1 FROM accounts AS inv WHERE inv.code = sale.code );
{ "outer_table": "projects", "inner_table": "accounts", "outer_alias": "sale", "inner_alias": "inv", "proj_col": "name", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00355
train
T1
v2
Schema: departments (alias: emp)(date, status, name, code) shipments(salary, amount, level, type) Task: Retrieve salary from departments that have at least one corresponding entry in shipments sharing the same id. SQL:
SELECT salary FROM departments AS emp WHERE EXISTS ( SELECT 1 FROM shipments AS acct WHERE acct.id = emp.id );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "emp", "inner_alias": "acct", "proj_col": "salary", "join_col": "id", "correlated_ref": "emp.id", "token_group": "T1" }
cs8_train_00356
train
T1
v1
Schema: transactions (alias: acct)(code, name, level, value) employees(status, date, amount, name) Task: Retrieve id from transactions whose type is found in employees rows where id matches the outer record. SQL:
SELECT id FROM transactions AS acct WHERE type IN ( SELECT type FROM employees AS rgn WHERE rgn.id = acct.id );
{ "outer_table": "transactions", "inner_table": "employees", "outer_alias": "acct", "inner_alias": "rgn", "proj_col": "id", "filter_col": "type", "join_col": "id", "correlated_ref": "acct.id", "token_group": "T1" }
cs8_train_00357
train
T1
v1
Schema: customers (alias: whs)(code, type, date, status) shipments(amount, name, id, level) Task: Find amount from customers where code appears in shipments entries with matching type. SQL:
SELECT amount FROM customers AS whs WHERE code IN ( SELECT code FROM shipments AS shp WHERE shp.type = whs.type );
{ "outer_table": "customers", "inner_table": "shipments", "outer_alias": "whs", "inner_alias": "shp", "proj_col": "amount", "filter_col": "code", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00358
train
T2
v3
Schema: regions (alias: acct)(status, date, level, type) branches(date, type, level, salary) Task: Find amount from regions where value exceeds the average value from branches for the same type. SQL:
SELECT amount FROM regions AS acct WHERE value > ( SELECT AVG(value) FROM branches AS rgn WHERE rgn.type = acct.type );
{ "outer_table": "regions", "inner_table": "branches", "outer_alias": "acct", "inner_alias": "rgn", "proj_col": "amount", "filter_col": "value", "agg_col": "value", "agg_fn": "AVG", "join_col": "type", "correlated_ref": "acct.type", "token_group": "T1" }
cs8_train_00359
train
T1
v1
Schema: branches (alias: lne)(status, type, amount, name) departments(salary, status, value, type) Task: Select value from branches where status exists in departments for the same id. SQL:
SELECT value FROM branches AS lne WHERE status IN ( SELECT status FROM departments AS srvc WHERE srvc.id = lne.id );
{ "outer_table": "branches", "inner_table": "departments", "outer_alias": "lne", "inner_alias": "srvc", "proj_col": "value", "filter_col": "status", "join_col": "id", "correlated_ref": "lne.id", "token_group": "T2" }
cs8_train_00360
train
T2
v2
Schema: transactions (alias: shp)(date, type, status, level) categories(name, salary, level, status) Task: Find amount from transactions where a matching record exists in categories with the same type. SQL:
SELECT amount FROM transactions AS shp WHERE EXISTS ( SELECT 1 FROM categories AS srvc WHERE srvc.type = shp.type );
{ "outer_table": "transactions", "inner_table": "categories", "outer_alias": "shp", "inner_alias": "srvc", "proj_col": "amount", "join_col": "type", "correlated_ref": "shp.type", "token_group": "T2" }
cs8_train_00361
train
T2
v3
Schema: customers (alias: srvc)(level, salary, id, code) tasks(type, amount, name, status) Task: Retrieve name from customers with salary above the AVG(salary) of tasks rows sharing the same status. SQL:
SELECT name FROM customers AS srvc WHERE salary > ( SELECT AVG(salary) FROM tasks AS sale WHERE sale.status = srvc.status );
{ "outer_table": "customers", "inner_table": "tasks", "outer_alias": "srvc", "inner_alias": "sale", "proj_col": "name", "filter_col": "salary", "agg_col": "salary", "agg_fn": "AVG", "join_col": "status", "correlated_ref": "srvc.status", "token_group": "T2" }
cs8_train_00362
train
T2
v1
Schema: categories (alias: inv)(level, amount, id, value) orders(salary, level, id, status) Task: Find id from categories where status appears in orders entries with matching type. SQL:
SELECT id FROM categories AS inv WHERE status IN ( SELECT status FROM orders AS prod WHERE prod.type = inv.type );
{ "outer_table": "categories", "inner_table": "orders", "outer_alias": "inv", "inner_alias": "prod", "proj_col": "id", "filter_col": "status", "join_col": "type", "correlated_ref": "inv.type", "token_group": "T1" }
cs8_train_00363
train
T1
v3
Schema: employees (alias: prod)(salary, date, type, code) departments(code, value, name, date) Task: Find salary from employees where value exceeds the average amount from departments for the same id. SQL:
SELECT salary FROM employees AS prod WHERE value > ( SELECT MIN(amount) FROM departments AS cust WHERE cust.id = prod.id );
{ "outer_table": "employees", "inner_table": "departments", "outer_alias": "prod", "inner_alias": "cust", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "MIN", "join_col": "id", "correlated_ref": "prod.id", "token_group": "T1" }
cs8_train_00364
train
T1
v3
Schema: projects (alias: inv)(code, date, level, name) orders(id, value, level, status) Task: Find salary from projects where value exceeds the average amount from orders for the same code. SQL:
SELECT salary FROM projects AS inv WHERE value > ( SELECT COUNT(amount) FROM orders AS sale WHERE sale.code = inv.code );
{ "outer_table": "projects", "inner_table": "orders", "outer_alias": "inv", "inner_alias": "sale", "proj_col": "salary", "filter_col": "value", "agg_col": "amount", "agg_fn": "COUNT", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00365
train
T1
v2
Schema: warehouses (alias: shp)(type, level, id, date) products(code, value, name, level) Task: Find value from warehouses where a matching record exists in products with the same type. SQL:
SELECT value FROM warehouses AS shp WHERE EXISTS ( SELECT 1 FROM products AS lne WHERE lne.type = shp.type );
{ "outer_table": "warehouses", "inner_table": "products", "outer_alias": "shp", "inner_alias": "lne", "proj_col": "value", "join_col": "type", "correlated_ref": "shp.type", "token_group": "T2" }
cs8_train_00366
train
T2
v1
Schema: regions (alias: budg)(amount, value, id, status) accounts(type, status, code, name) Task: Select salary from regions where id exists in accounts for the same status. SQL:
SELECT salary FROM regions AS budg WHERE id IN ( SELECT id FROM accounts AS whs WHERE whs.status = budg.status );
{ "outer_table": "regions", "inner_table": "accounts", "outer_alias": "budg", "inner_alias": "whs", "proj_col": "salary", "filter_col": "id", "join_col": "status", "correlated_ref": "budg.status", "token_group": "T2" }
cs8_train_00367
train
T2
v1
Schema: customers (alias: schd)(value, date, type, amount) regions(salary, code, amount, id) Task: Select code from customers where code exists in regions for the same type. SQL:
SELECT code FROM customers AS schd WHERE code IN ( SELECT code FROM regions AS catg WHERE catg.type = schd.type );
{ "outer_table": "customers", "inner_table": "regions", "outer_alias": "schd", "inner_alias": "catg", "proj_col": "code", "filter_col": "code", "join_col": "type", "correlated_ref": "schd.type", "token_group": "T2" }
cs8_train_00368
train
T2
v2
Schema: products (alias: txn)(amount, status, name, level) projects(salary, name, value, amount) Task: Retrieve value from products that have at least one corresponding entry in projects sharing the same status. SQL:
SELECT value FROM products AS txn WHERE EXISTS ( SELECT 1 FROM projects AS inv WHERE inv.status = txn.status );
{ "outer_table": "products", "inner_table": "projects", "outer_alias": "txn", "inner_alias": "inv", "proj_col": "value", "join_col": "status", "correlated_ref": "txn.status", "token_group": "T1" }
cs8_train_00369
train
T1
v2
Schema: products (alias: schd)(amount, level, value, type) suppliers(amount, status, type, level) Task: Find amount from products where a matching record exists in suppliers with the same type. SQL:
SELECT amount FROM products AS schd WHERE EXISTS ( SELECT 1 FROM suppliers AS empl WHERE empl.type = schd.type );
{ "outer_table": "products", "inner_table": "suppliers", "outer_alias": "schd", "inner_alias": "empl", "proj_col": "amount", "join_col": "type", "correlated_ref": "schd.type", "token_group": "T2" }
cs8_train_00370
train
T2
v2
Schema: suppliers (alias: lne)(type, date, amount, code) orders(id, code, name, date) Task: Find code from suppliers where a matching record exists in orders with the same type. SQL:
SELECT code FROM suppliers AS lne WHERE EXISTS ( SELECT 1 FROM orders AS prod WHERE prod.type = lne.type );
{ "outer_table": "suppliers", "inner_table": "orders", "outer_alias": "lne", "inner_alias": "prod", "proj_col": "code", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_train_00371
train
T2
v2
Schema: orders (alias: lne)(amount, status, date, value) suppliers(id, status, code, salary) Task: Retrieve value from orders that have at least one corresponding entry in suppliers sharing the same type. SQL:
SELECT value FROM orders AS lne WHERE EXISTS ( SELECT 1 FROM suppliers AS schd WHERE schd.type = lne.type );
{ "outer_table": "orders", "inner_table": "suppliers", "outer_alias": "lne", "inner_alias": "schd", "proj_col": "value", "join_col": "type", "correlated_ref": "lne.type", "token_group": "T2" }
cs8_train_00372
train
T2
v2
Schema: suppliers (alias: shp)(level, status, date, salary) accounts(salary, date, status, level) Task: Find code from suppliers where a matching record exists in accounts with the same id. SQL:
SELECT code FROM suppliers AS shp WHERE EXISTS ( SELECT 1 FROM accounts AS whs WHERE whs.id = shp.id );
{ "outer_table": "suppliers", "inner_table": "accounts", "outer_alias": "shp", "inner_alias": "whs", "proj_col": "code", "join_col": "id", "correlated_ref": "shp.id", "token_group": "T2" }
cs8_train_00373
train
T2
v1
Schema: suppliers (alias: mgr)(salary, amount, type, id) accounts(id, salary, value, type) Task: Find amount from suppliers where level appears in accounts entries with matching status. SQL:
SELECT amount FROM suppliers AS mgr WHERE level IN ( SELECT level FROM accounts AS inv WHERE inv.status = mgr.status );
{ "outer_table": "suppliers", "inner_table": "accounts", "outer_alias": "mgr", "inner_alias": "inv", "proj_col": "amount", "filter_col": "level", "join_col": "status", "correlated_ref": "mgr.status", "token_group": "T1" }
cs8_train_00374
train
T1
v3
Schema: customers (alias: sale)(code, date, salary, level) regions(level, value, date, type) Task: Retrieve code from customers with amount above the MAX(salary) of regions rows sharing the same level. SQL:
SELECT code FROM customers AS sale WHERE amount > ( SELECT MAX(salary) FROM regions AS ord WHERE ord.level = sale.level );
{ "outer_table": "customers", "inner_table": "regions", "outer_alias": "sale", "inner_alias": "ord", "proj_col": "code", "filter_col": "amount", "agg_col": "salary", "agg_fn": "MAX", "join_col": "level", "correlated_ref": "sale.level", "token_group": "T1" }
cs8_train_00375
train
T1
v1
Schema: projects (alias: prod)(name, status, amount, type) employees(level, id, type, date) Task: Select salary from projects where id exists in employees for the same id. SQL:
SELECT salary FROM projects AS prod WHERE id IN ( SELECT id FROM employees AS emp WHERE emp.id = prod.id );
{ "outer_table": "projects", "inner_table": "employees", "outer_alias": "prod", "inner_alias": "emp", "proj_col": "salary", "filter_col": "id", "join_col": "id", "correlated_ref": "prod.id", "token_group": "T1" }
cs8_train_00376
train
T1
v1
Schema: regions (alias: emp)(type, code, status, value) suppliers(id, date, salary, value) Task: Select amount from regions where id exists in suppliers for the same id. SQL:
SELECT amount FROM regions AS emp WHERE id IN ( SELECT id FROM suppliers AS txn WHERE txn.id = emp.id );
{ "outer_table": "regions", "inner_table": "suppliers", "outer_alias": "emp", "inner_alias": "txn", "proj_col": "amount", "filter_col": "id", "join_col": "id", "correlated_ref": "emp.id", "token_group": "T1" }
cs8_train_00377
train
T1
v2
Schema: products (alias: catg)(id, type, code, name) warehouses(salary, name, type, level) Task: Find value from products where a matching record exists in warehouses with the same code. SQL:
SELECT value FROM products AS catg WHERE EXISTS ( SELECT 1 FROM warehouses AS ordr WHERE ordr.code = catg.code );
{ "outer_table": "products", "inner_table": "warehouses", "outer_alias": "catg", "inner_alias": "ordr", "proj_col": "value", "join_col": "code", "correlated_ref": "catg.code", "token_group": "T2" }
cs8_train_00378
train
T2
v3
Schema: shipments (alias: dept)(value, type, code, amount) transactions(type, salary, status, date) Task: Retrieve value from shipments with salary above the MIN(amount) of transactions rows sharing the same level. SQL:
SELECT value FROM shipments AS dept WHERE salary > ( SELECT MIN(amount) FROM transactions AS empl WHERE empl.level = dept.level );
{ "outer_table": "shipments", "inner_table": "transactions", "outer_alias": "dept", "inner_alias": "empl", "proj_col": "value", "filter_col": "salary", "agg_col": "amount", "agg_fn": "MIN", "join_col": "level", "correlated_ref": "dept.level", "token_group": "T1" }
cs8_train_00379
train
T1
v2
Schema: orders (alias: txn)(salary, amount, date, code) suppliers(type, status, id, date) Task: Find value from orders where a matching record exists in suppliers with the same level. SQL:
SELECT value FROM orders AS txn WHERE EXISTS ( SELECT 1 FROM suppliers AS catg WHERE catg.level = txn.level );
{ "outer_table": "orders", "inner_table": "suppliers", "outer_alias": "txn", "inner_alias": "catg", "proj_col": "value", "join_col": "level", "correlated_ref": "txn.level", "token_group": "T1" }
cs8_train_00380
train
T1
v2
Schema: employees (alias: budg)(date, amount, value, id) projects(value, date, id, code) Task: Find code from employees where a matching record exists in projects with the same status. SQL:
SELECT code FROM employees AS budg WHERE EXISTS ( SELECT 1 FROM projects AS lne WHERE lne.status = budg.status );
{ "outer_table": "employees", "inner_table": "projects", "outer_alias": "budg", "inner_alias": "lne", "proj_col": "code", "join_col": "status", "correlated_ref": "budg.status", "token_group": "T2" }
cs8_train_00381
train
T2
v3
Schema: products (alias: sale)(value, salary, date, amount) employees(status, id, date, name) Task: Retrieve salary from products with salary above the AVG(amount) of employees rows sharing the same code. SQL:
SELECT salary FROM products AS sale WHERE salary > ( SELECT AVG(amount) FROM employees AS empl WHERE empl.code = sale.code );
{ "outer_table": "products", "inner_table": "employees", "outer_alias": "sale", "inner_alias": "empl", "proj_col": "salary", "filter_col": "salary", "agg_col": "amount", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "sale.code", "token_group": "T1" }
cs8_train_00382
train
T1
v1
Schema: categories (alias: rgn)(level, amount, id, type) projects(amount, id, code, value) Task: Find code from categories where level appears in projects entries with matching type. SQL:
SELECT code FROM categories AS rgn WHERE level IN ( SELECT level FROM projects AS srvc WHERE srvc.type = rgn.type );
{ "outer_table": "categories", "inner_table": "projects", "outer_alias": "rgn", "inner_alias": "srvc", "proj_col": "code", "filter_col": "level", "join_col": "type", "correlated_ref": "rgn.type", "token_group": "T2" }
cs8_train_00383
train
T2
v2
Schema: products (alias: cust)(level, name, date, status) branches(amount, id, code, value) Task: Find amount from products where a matching record exists in branches with the same code. SQL:
SELECT amount FROM products AS cust WHERE EXISTS ( SELECT 1 FROM branches AS shp WHERE shp.code = cust.code );
{ "outer_table": "products", "inner_table": "branches", "outer_alias": "cust", "inner_alias": "shp", "proj_col": "amount", "join_col": "code", "correlated_ref": "cust.code", "token_group": "T1" }
cs8_train_00384
train
T1
v3
Schema: tasks (alias: whs)(value, date, name, salary) categories(value, code, type, name) Task: Retrieve id from tasks with value above the MIN(value) of categories rows sharing the same type. SQL:
SELECT id FROM tasks AS whs WHERE value > ( SELECT MIN(value) FROM categories AS rgn WHERE rgn.type = whs.type );
{ "outer_table": "tasks", "inner_table": "categories", "outer_alias": "whs", "inner_alias": "rgn", "proj_col": "id", "filter_col": "value", "agg_col": "value", "agg_fn": "MIN", "join_col": "type", "correlated_ref": "whs.type", "token_group": "T2" }
cs8_train_00385
train
T2
v3
Schema: departments (alias: sale)(name, type, status, date) tasks(amount, id, code, value) Task: Find value from departments where value exceeds the average value from tasks for the same level. SQL:
SELECT value FROM departments AS sale WHERE value > ( SELECT COUNT(value) FROM tasks AS lne WHERE lne.level = sale.level );
{ "outer_table": "departments", "inner_table": "tasks", "outer_alias": "sale", "inner_alias": "lne", "proj_col": "value", "filter_col": "value", "agg_col": "value", "agg_fn": "COUNT", "join_col": "level", "correlated_ref": "sale.level", "token_group": "T1" }
cs8_train_00386
train
T1
v3
Schema: accounts (alias: sale)(level, amount, name, value) orders(date, name, amount, salary) Task: Find name from accounts where amount exceeds the average salary from orders for the same type. SQL:
SELECT name FROM accounts AS sale WHERE amount > ( SELECT SUM(salary) FROM orders AS inv WHERE inv.type = sale.type );
{ "outer_table": "accounts", "inner_table": "orders", "outer_alias": "sale", "inner_alias": "inv", "proj_col": "name", "filter_col": "amount", "agg_col": "salary", "agg_fn": "SUM", "join_col": "type", "correlated_ref": "sale.type", "token_group": "T1" }
cs8_train_00387
train
T1
v3
Schema: warehouses (alias: txn)(code, amount, value, name) regions(name, amount, value, status) Task: Find salary from warehouses where value exceeds the average value from regions for the same status. SQL:
SELECT salary FROM warehouses AS txn WHERE value > ( SELECT COUNT(value) FROM regions AS dept WHERE dept.status = txn.status );
{ "outer_table": "warehouses", "inner_table": "regions", "outer_alias": "txn", "inner_alias": "dept", "proj_col": "salary", "filter_col": "value", "agg_col": "value", "agg_fn": "COUNT", "join_col": "status", "correlated_ref": "txn.status", "token_group": "T1" }
cs8_train_00388
train
T1
v1
Schema: products (alias: empl)(status, amount, value, id) customers(id, value, amount, salary) Task: Find code from products where status appears in customers entries with matching status. SQL:
SELECT code FROM products AS empl WHERE status IN ( SELECT status FROM customers AS lne WHERE lne.status = empl.status );
{ "outer_table": "products", "inner_table": "customers", "outer_alias": "empl", "inner_alias": "lne", "proj_col": "code", "filter_col": "status", "join_col": "status", "correlated_ref": "empl.status", "token_group": "T2" }
cs8_train_00389
train
T2
v2
Schema: accounts (alias: prod)(amount, name, code, date) orders(code, date, name, amount) Task: Find amount from accounts where a matching record exists in orders with the same code. SQL:
SELECT amount FROM accounts AS prod WHERE EXISTS ( SELECT 1 FROM orders AS cust WHERE cust.code = prod.code );
{ "outer_table": "accounts", "inner_table": "orders", "outer_alias": "prod", "inner_alias": "cust", "proj_col": "amount", "join_col": "code", "correlated_ref": "prod.code", "token_group": "T1" }
cs8_train_00390
train
T1
v2
Schema: products (alias: schd)(name, amount, status, date) shipments(type, value, code, id) Task: Find amount from products where a matching record exists in shipments with the same code. SQL:
SELECT amount FROM products AS schd WHERE EXISTS ( SELECT 1 FROM shipments AS rgn WHERE rgn.code = schd.code );
{ "outer_table": "products", "inner_table": "shipments", "outer_alias": "schd", "inner_alias": "rgn", "proj_col": "amount", "join_col": "code", "correlated_ref": "schd.code", "token_group": "T2" }
cs8_train_00391
train
T2
v3
Schema: branches (alias: inv)(level, salary, amount, status) warehouses(status, level, code, amount) Task: Find id from branches where amount exceeds the average value from warehouses for the same code. SQL:
SELECT id FROM branches AS inv WHERE amount > ( SELECT AVG(value) FROM warehouses AS txn WHERE txn.code = inv.code );
{ "outer_table": "branches", "inner_table": "warehouses", "outer_alias": "inv", "inner_alias": "txn", "proj_col": "id", "filter_col": "amount", "agg_col": "value", "agg_fn": "AVG", "join_col": "code", "correlated_ref": "inv.code", "token_group": "T1" }
cs8_train_00392
train
T1
v2
Schema: invoices (alias: mgr)(status, type, level, name) orders(value, level, amount, type) Task: Find code from invoices where a matching record exists in orders with the same level. SQL:
SELECT code FROM invoices AS mgr WHERE EXISTS ( SELECT 1 FROM orders AS budg WHERE budg.level = mgr.level );
{ "outer_table": "invoices", "inner_table": "orders", "outer_alias": "mgr", "inner_alias": "budg", "proj_col": "code", "join_col": "level", "correlated_ref": "mgr.level", "token_group": "T1" }
cs8_train_00393
train
T1
v1
Schema: departments (alias: schd)(level, type, date, id) shipments(name, type, id, code) Task: Retrieve code from departments whose type is found in shipments rows where status matches the outer record. SQL:
SELECT code FROM departments AS schd WHERE type IN ( SELECT type FROM shipments AS empl WHERE empl.status = schd.status );
{ "outer_table": "departments", "inner_table": "shipments", "outer_alias": "schd", "inner_alias": "empl", "proj_col": "code", "filter_col": "type", "join_col": "status", "correlated_ref": "schd.status", "token_group": "T2" }
cs8_train_00394
train
T2
v2
Schema: customers (alias: ordr)(salary, amount, date, value) suppliers(status, level, type, date) Task: Find salary from customers where a matching record exists in suppliers with the same type. SQL:
SELECT salary FROM customers AS ordr WHERE EXISTS ( SELECT 1 FROM suppliers AS inv WHERE inv.type = ordr.type );
{ "outer_table": "customers", "inner_table": "suppliers", "outer_alias": "ordr", "inner_alias": "inv", "proj_col": "salary", "join_col": "type", "correlated_ref": "ordr.type", "token_group": "T2" }
cs8_train_00395
train
T2
v2
Schema: invoices (alias: acct)(date, level, status, name) branches(salary, level, id, date) Task: Retrieve salary from invoices that have at least one corresponding entry in branches sharing the same code. SQL:
SELECT salary FROM invoices AS acct WHERE EXISTS ( SELECT 1 FROM branches AS srvc WHERE srvc.code = acct.code );
{ "outer_table": "invoices", "inner_table": "branches", "outer_alias": "acct", "inner_alias": "srvc", "proj_col": "salary", "join_col": "code", "correlated_ref": "acct.code", "token_group": "T1" }
cs8_train_00396
train
T1
v2
Schema: warehouses (alias: srvc)(code, type, status, value) tasks(status, id, date, type) Task: Retrieve name from warehouses that have at least one corresponding entry in tasks sharing the same id. SQL:
SELECT name FROM warehouses AS srvc WHERE EXISTS ( SELECT 1 FROM tasks AS prod WHERE prod.id = srvc.id );
{ "outer_table": "warehouses", "inner_table": "tasks", "outer_alias": "srvc", "inner_alias": "prod", "proj_col": "name", "join_col": "id", "correlated_ref": "srvc.id", "token_group": "T2" }
cs8_train_00397
train
T2
v1
Schema: tasks (alias: empl)(id, salary, code, status) shipments(amount, salary, date, code) Task: Retrieve name from tasks whose id is found in shipments rows where type matches the outer record. SQL:
SELECT name FROM tasks AS empl WHERE id IN ( SELECT id FROM shipments AS ordr WHERE ordr.type = empl.type );
{ "outer_table": "tasks", "inner_table": "shipments", "outer_alias": "empl", "inner_alias": "ordr", "proj_col": "name", "filter_col": "id", "join_col": "type", "correlated_ref": "empl.type", "token_group": "T2" }
cs8_train_00398
train
T2
v3
Schema: employees (alias: inv)(code, date, name, salary) tasks(amount, value, status, level) Task: Find salary from employees where amount exceeds the average value from tasks for the same status. SQL:
SELECT salary FROM employees AS inv WHERE amount > ( SELECT SUM(value) FROM tasks AS ord WHERE ord.status = inv.status );
{ "outer_table": "employees", "inner_table": "tasks", "outer_alias": "inv", "inner_alias": "ord", "proj_col": "salary", "filter_col": "amount", "agg_col": "value", "agg_fn": "SUM", "join_col": "status", "correlated_ref": "inv.status", "token_group": "T1" }
cs8_train_00399
train
T1