Prompt:
Schema:
  departments (alias: emp)(code, value, name, date)
  products(status, salary, type, level)
Task: Retrieve id from departments whose code is found in products rows where type matches the outer record.
SQL:

SELECT id FROM departments AS emp
WHERE code IN (
    SELECT code FROM products AS ordr
    WHERE ordr.type = emp.type
);


Prompt:
Schema:
  employees (alias: emp)(status, level, name, type)
  shipments(status, salary, name, code)
Task: Retrieve id from employees with amount above the MIN(salary) of shipments rows sharing the same id.
SQL:

SELECT id FROM employees AS emp
WHERE amount > (
    SELECT MIN(salary) FROM shipments AS mgr
    WHERE mgr.id = emp.id
);


Prompt:
Schema:
  warehouses (alias: whs)(type, id, salary, amount)
  categories(name, amount, code, salary)
Task: Find code from warehouses where value exceeds the average salary from categories for the same code.
SQL:

SELECT code FROM warehouses AS whs
WHERE value > (
    SELECT MIN(salary) FROM categories AS shp
    WHERE shp.code = whs.code
);


Prompt:
Schema:
  invoices (alias: acct)(date, salary, level, type)
  departments(name, level, status, salary)
Task: Retrieve value from invoices whose status is found in departments rows where id matches the outer record.
SQL:

SELECT value FROM invoices AS acct
WHERE status IN (
    SELECT status FROM departments AS dept
    WHERE dept.id = acct.id
);


Prompt:
Schema:
  branches (alias: sale)(code, name, type, status)
  warehouses(name, type, code, value)
Task: Find code from branches where value exceeds the average value from warehouses for the same id.
SQL:

SELECT code FROM branches AS sale
WHERE value > (
    SELECT MAX(value) FROM warehouses AS emp
    WHERE emp.id = sale.id
);


Prompt:
Schema:
  orders (alias: txn)(amount, level, type, code)
  accounts(date, amount, level, code)
Task: Select code from orders where id exists in accounts for the same code.
SQL:

SELECT code FROM orders AS txn
WHERE id IN (
    SELECT id FROM accounts AS empl
    WHERE empl.code = txn.code
);


Prompt:
Schema:
  accounts (alias: rgn)(salary, type, id, value)
  branches(salary, amount, code, status)
Task: Find salary from accounts where amount exceeds the average amount from branches for the same code.
SQL:

SELECT salary FROM accounts AS rgn
WHERE amount > (
    SELECT AVG(amount) FROM branches AS inv
    WHERE inv.code = rgn.code
);


Prompt:
Schema:
  products (alias: catg)(code, name, value, amount)
  projects(status, salary, date, amount)
Task: Retrieve amount from products whose id is found in projects rows where id matches the outer record.
SQL:

SELECT amount FROM products AS catg
WHERE id IN (
    SELECT id FROM projects AS inv
    WHERE inv.id = catg.id
);


Prompt:
Schema:
  orders (alias: sale)(value, id, type, amount)
  shipments(value, code, salary, id)
Task: Retrieve amount from orders whose id is found in shipments rows where type matches the outer record.
SQL:

SELECT amount FROM orders AS sale
WHERE id IN (
    SELECT id FROM shipments AS inv
    WHERE inv.type = sale.type
);


Prompt:
Schema:
  projects (alias: whs)(value, id, name, level)
  employees(amount, id, code, name)
Task: Find id from projects where value exceeds the average amount from employees for the same status.
SQL:

SELECT id FROM projects AS whs
WHERE value > (
    SELECT SUM(amount) FROM employees AS rgn
    WHERE rgn.status = whs.status
);


Prompt:
Schema:
  projects (alias: budg)(status, id, code, salary)
  branches(value, type, name, salary)
Task: Find salary from projects where a matching record exists in branches with the same status.
SQL:

SELECT salary FROM projects AS budg
WHERE EXISTS (
    SELECT 1 FROM branches AS prod
    WHERE prod.status = budg.status
);


Prompt:
Schema:
  departments (alias: shp)(id, type, status, code)
  regions(name, amount, id, date)
Task: Find salary from departments where amount exceeds the average amount from regions for the same status.
SQL:

SELECT salary FROM departments AS shp
WHERE amount > (
    SELECT SUM(amount) FROM regions AS lne
    WHERE lne.status = shp.status
);


Prompt:
Schema:
  transactions (alias: srvc)(name, code, type, date)
  products(code, name, salary, id)
Task: Retrieve name from transactions that have at least one corresponding entry in products sharing the same code.
SQL:

SELECT name FROM transactions AS srvc
WHERE EXISTS (
    SELECT 1 FROM products AS catg
    WHERE catg.code = srvc.code
);


Prompt:
Schema:
  branches (alias: whs)(name, amount, salary, code)
  projects(name, status, amount, date)
Task: Retrieve value from branches whose status is found in projects rows where type matches the outer record.
SQL:

SELECT value FROM branches AS whs
WHERE status IN (
    SELECT status FROM projects AS rgn
    WHERE rgn.type = whs.type
);


Prompt:
Schema:
  shipments (alias: catg)(level, salary, name, value)
  products(id, name, type, level)
Task: Retrieve id from shipments with amount above the AVG(value) of products rows sharing the same type.
SQL:

SELECT id FROM shipments AS catg
WHERE amount > (
    SELECT AVG(value) FROM products AS empl
    WHERE empl.type = catg.type
);


Prompt:
Schema:
  transactions (alias: txn)(value, code, id, salary)
  projects(value, code, id, type)
Task: Find name from transactions where a matching record exists in projects with the same status.
SQL:

SELECT name FROM transactions AS txn
WHERE EXISTS (
    SELECT 1 FROM projects AS cust
    WHERE cust.status = txn.status
);


Prompt:
Schema:
  products (alias: txn)(salary, name, id, value)
  categories(name, status, code, id)
Task: Find name from products where code appears in categories entries with matching type.
SQL:

SELECT name FROM products AS txn
WHERE code IN (
    SELECT code FROM categories AS inv
    WHERE inv.type = txn.type
);


Prompt:
Schema:
  branches (alias: lne)(id, name, status, salary)
  accounts(value, type, name, level)
Task: Find value from branches where a matching record exists in accounts with the same type.
SQL:

SELECT value FROM branches AS lne
WHERE EXISTS (
    SELECT 1 FROM accounts AS prod
    WHERE prod.type = lne.type
);


Prompt:
Schema:
  employees (alias: sale)(level, id, salary, date)
  accounts(status, level, type, date)
Task: Retrieve name from employees with value above the SUM(salary) of accounts rows sharing the same type.
SQL:

SELECT name FROM employees AS sale
WHERE value > (
    SELECT SUM(salary) FROM accounts AS dept
    WHERE dept.type = sale.type
);


Prompt:
Schema:
  projects (alias: inv)(name, salary, amount, level)
  categories(id, type, status, name)
Task: Retrieve value from projects that have at least one corresponding entry in categories sharing the same id.
SQL:

SELECT value FROM projects AS inv
WHERE EXISTS (
    SELECT 1 FROM categories AS cust
    WHERE cust.id = inv.id
);


Prompt:
Schema:
  branches (alias: txn)(type, level, amount, status)
  categories(code, salary, status, id)
Task: Find amount from branches where amount exceeds the average amount from categories for the same level.
SQL:

SELECT amount FROM branches AS txn
WHERE amount > (
    SELECT COUNT(amount) FROM categories AS rgn
    WHERE rgn.level = txn.level
);


Prompt:
Schema:
  suppliers (alias: mgr)(id, code, amount, status)
  regions(value, date, type, name)
Task: Find amount from suppliers where value exceeds the average amount from regions for the same code.
SQL:

SELECT amount FROM suppliers AS mgr
WHERE value > (
    SELECT COUNT(amount) FROM regions AS empl
    WHERE empl.code = mgr.code
);


Prompt:
Schema:
  projects (alias: shp)(date, level, id, value)
  regions(value, code, type, amount)
Task: Retrieve value from projects whose id is found in regions rows where id matches the outer record.
SQL:

SELECT value FROM projects AS shp
WHERE id IN (
    SELECT id FROM regions AS schd
    WHERE schd.id = shp.id
);


Prompt:
Schema:
  orders (alias: schd)(level, code, date, amount)
  branches(name, amount, code, date)
Task: Retrieve code from orders whose level is found in branches rows where type matches the outer record.
SQL:

SELECT code FROM orders AS schd
WHERE level IN (
    SELECT level FROM branches AS cust
    WHERE cust.type = schd.type
);


Prompt:
Schema:
  departments (alias: cust)(date, value, id, salary)
  categories(value, salary, id, code)
Task: Retrieve amount from departments with salary above the MAX(salary) of categories rows sharing the same code.
SQL:

SELECT amount FROM departments AS cust
WHERE salary > (
    SELECT MAX(salary) FROM categories AS txn
    WHERE txn.code = cust.code
);


Prompt:
Schema:
  categories (alias: empl)(type, level, code, value)
  tasks(value, type, id, salary)
Task: Retrieve value from categories that have at least one corresponding entry in tasks sharing the same status.
SQL:

SELECT value FROM categories AS empl
WHERE EXISTS (
    SELECT 1 FROM tasks AS txn
    WHERE txn.status = empl.status
);


Prompt:
Schema:
  branches (alias: budg)(type, date, value, level)
  projects(amount, id, salary, value)
Task: Select code from branches where level exists in projects for the same type.
SQL:

SELECT code FROM branches AS budg
WHERE level IN (
    SELECT level FROM projects AS srvc
    WHERE srvc.type = budg.type
);


Prompt:
Schema:
  suppliers (alias: ordr)(level, salary, name, type)
  tasks(salary, status, date, type)
Task: Retrieve amount from suppliers that have at least one corresponding entry in tasks sharing the same status.
SQL:

SELECT amount FROM suppliers AS ordr
WHERE EXISTS (
    SELECT 1 FROM tasks AS srvc
    WHERE srvc.status = ordr.status
);


Prompt:
Schema:
  accounts (alias: dept)(level, status, salary, code)
  employees(date, value, id, level)
Task: Find name from accounts where a matching record exists in employees with the same code.
SQL:

SELECT name FROM accounts AS dept
WHERE EXISTS (
    SELECT 1 FROM employees AS rgn
    WHERE rgn.code = dept.code
);


Prompt:
Schema:
  products (alias: inv)(type, id, status, level)
  branches(level, status, date, type)
Task: Find id from products where amount exceeds the average value from branches for the same level.
SQL:

SELECT id FROM products AS inv
WHERE amount > (
    SELECT COUNT(value) FROM branches AS lne
    WHERE lne.level = inv.level
);


Prompt:
Schema:
  accounts (alias: acct)(status, level, amount, name)
  transactions(value, salary, id, status)
Task: Retrieve name from accounts whose type is found in transactions rows where status matches the outer record.
SQL:

SELECT name FROM accounts AS acct
WHERE type IN (
    SELECT type FROM transactions AS whs
    WHERE whs.status = acct.status
);


Prompt:
Schema:
  warehouses (alias: lne)(type, salary, level, amount)
  shipments(date, name, type, code)
Task: Retrieve name from warehouses with salary above the SUM(salary) of shipments rows sharing the same code.
SQL:

SELECT name FROM warehouses AS lne
WHERE salary > (
    SELECT SUM(salary) FROM shipments AS ord
    WHERE ord.code = lne.code
);


Prompt:
Schema:
  suppliers (alias: emp)(date, level, status, name)
  transactions(name, value, code, status)
Task: Select name from suppliers where level exists in transactions for the same code.
SQL:

SELECT name FROM suppliers AS emp
WHERE level IN (
    SELECT level FROM transactions AS empl
    WHERE empl.code = emp.code
);


Prompt:
Schema:
  categories (alias: budg)(value, code, salary, name)
  products(status, code, salary, date)
Task: Retrieve amount from categories that have at least one corresponding entry in products sharing the same id.
SQL:

SELECT amount FROM categories AS budg
WHERE EXISTS (
    SELECT 1 FROM products AS cust
    WHERE cust.id = budg.id
);


Prompt:
Schema:
  transactions (alias: rgn)(id, salary, status, amount)
  branches(amount, salary, name, code)
Task: Retrieve id from transactions whose level is found in branches rows where status matches the outer record.
SQL:

SELECT id FROM transactions AS rgn
WHERE level IN (
    SELECT level FROM branches AS lne
    WHERE lne.status = rgn.status
);


Prompt:
Schema:
  products (alias: empl)(value, name, type, salary)
  branches(type, value, status, code)
Task: Retrieve code from products with amount above the MIN(amount) of branches rows sharing the same status.
SQL:

SELECT code FROM products AS empl
WHERE amount > (
    SELECT MIN(amount) FROM branches AS whs
    WHERE whs.status = empl.status
);


Prompt:
Schema:
  shipments (alias: srvc)(value, code, status, amount)
  orders(status, id, salary, name)
Task: Select id from shipments where id exists in orders for the same level.
SQL:

SELECT id FROM shipments AS srvc
WHERE id IN (
    SELECT id FROM orders AS rgn
    WHERE rgn.level = srvc.level
);


Prompt:
Schema:
  categories (alias: dept)(value, level, id, salary)
  accounts(name, salary, amount, level)
Task: Retrieve id from categories whose status is found in accounts rows where id matches the outer record.
SQL:

SELECT id FROM categories AS dept
WHERE status IN (
    SELECT status FROM accounts AS srvc
    WHERE srvc.id = dept.id
);


Prompt:
Schema:
  branches (alias: shp)(amount, id, level, name)
  regions(code, type, id, name)
Task: Find name from branches where value exceeds the average value from regions for the same id.
SQL:

SELECT name FROM branches AS shp
WHERE value > (
    SELECT AVG(value) FROM regions AS whs
    WHERE whs.id = shp.id
);


Prompt:
Schema:
  employees (alias: empl)(value, name, salary, code)
  categories(value, amount, code, level)
Task: Find amount from employees where a matching record exists in categories with the same type.
SQL:

SELECT amount FROM employees AS empl
WHERE EXISTS (
    SELECT 1 FROM categories AS srvc
    WHERE srvc.type = empl.type
);


Prompt:
Schema:
  categories (alias: ordr)(code, level, amount, status)
  invoices(amount, code, name, salary)
Task: Find value from categories where id appears in invoices entries with matching level.
SQL:

SELECT value FROM categories AS ordr
WHERE id IN (
    SELECT id FROM invoices AS acct
    WHERE acct.level = ordr.level
);


Prompt:
Schema:
  accounts (alias: catg)(type, date, id, level)
  categories(value, salary, name, date)
Task: Find amount from accounts where a matching record exists in categories with the same id.
SQL:

SELECT amount FROM accounts AS catg
WHERE EXISTS (
    SELECT 1 FROM categories AS ordr
    WHERE ordr.id = catg.id
);


Prompt:
Schema:
  categories (alias: prod)(status, type, salary, level)
  products(level, status, code, id)
Task: Find code from categories where a matching record exists in products with the same code.
SQL:

SELECT code FROM categories AS prod
WHERE EXISTS (
    SELECT 1 FROM products AS empl
    WHERE empl.code = prod.code
);


Prompt:
Schema:
  orders (alias: dept)(date, level, status, type)
  warehouses(name, status, type, level)
Task: Retrieve salary from orders whose id is found in warehouses rows where id matches the outer record.
SQL:

SELECT salary FROM orders AS dept
WHERE id IN (
    SELECT id FROM warehouses AS acct
    WHERE acct.id = dept.id
);


Prompt:
Schema:
  departments (alias: txn)(level, id, salary, amount)
  suppliers(level, date, salary, type)
Task: Find amount from departments where a matching record exists in suppliers with the same type.
SQL:

SELECT amount FROM departments AS txn
WHERE EXISTS (
    SELECT 1 FROM suppliers AS cust
    WHERE cust.type = txn.type
);


Prompt:
Schema:
  accounts (alias: mgr)(salary, status, type, level)
  regions(code, salary, level, date)
Task: Find salary from accounts where a matching record exists in regions with the same type.
SQL:

SELECT salary FROM accounts AS mgr
WHERE EXISTS (
    SELECT 1 FROM regions AS empl
    WHERE empl.type = mgr.type
);


Prompt:
Schema:
  branches (alias: shp)(name, value, date, salary)
  transactions(type, salary, level, id)
Task: Retrieve amount from branches with amount above the SUM(value) of transactions rows sharing the same type.
SQL:

SELECT amount FROM branches AS shp
WHERE amount > (
    SELECT SUM(value) FROM transactions AS ordr
    WHERE ordr.type = shp.type
);


Prompt:
Schema:
  categories (alias: budg)(level, date, amount, type)
  suppliers(value, date, id, type)
Task: Find amount from categories where code appears in suppliers entries with matching type.
SQL:

SELECT amount FROM categories AS budg
WHERE code IN (
    SELECT code FROM suppliers AS rgn
    WHERE rgn.type = budg.type
);


Prompt:
Schema:
  suppliers (alias: inv)(code, type, level, id)
  tasks(id, type, amount, status)
Task: Retrieve value from suppliers whose id is found in tasks rows where level matches the outer record.
SQL:

SELECT value FROM suppliers AS inv
WHERE id IN (
    SELECT id FROM tasks AS acct
    WHERE acct.level = inv.level
);


Prompt:
Schema:
  tasks (alias: ordr)(value, id, status, level)
  accounts(salary, value, name, code)
Task: Find value from tasks where code appears in accounts entries with matching status.
SQL:

SELECT value FROM tasks AS ordr
WHERE code IN (
    SELECT code FROM accounts AS catg
    WHERE catg.status = ordr.status
);


Prompt:
Schema:
  regions (alias: lne)(value, id, level, type)
  shipments(value, date, salary, name)
Task: Find value from regions where value exceeds the average salary from shipments for the same id.
SQL:

SELECT value FROM regions AS lne
WHERE value > (
    SELECT MIN(salary) FROM shipments AS schd
    WHERE schd.id = lne.id
);


Prompt:
Schema:
  transactions (alias: catg)(salary, level, value, type)
  suppliers(status, id, salary, type)
Task: Retrieve code from transactions whose status is found in suppliers rows where status matches the outer record.
SQL:

SELECT code FROM transactions AS catg
WHERE status IN (
    SELECT status FROM suppliers AS acct
    WHERE acct.status = catg.status
);


Prompt:
Schema:
  products (alias: empl)(salary, status, value, amount)
  orders(id, code, name, type)
Task: Find code from products where a matching record exists in orders with the same status.
SQL:

SELECT code FROM products AS empl
WHERE EXISTS (
    SELECT 1 FROM orders AS shp
    WHERE shp.status = empl.status
);


Prompt:
Schema:
  projects (alias: srvc)(id, name, type, level)
  products(level, salary, amount, code)
Task: Retrieve name from projects whose id is found in products rows where level matches the outer record.
SQL:

SELECT name FROM projects AS srvc
WHERE id IN (
    SELECT id FROM products AS txn
    WHERE txn.level = srvc.level
);


Prompt:
Schema:
  tasks (alias: catg)(value, date, id, level)
  projects(status, id, code, amount)
Task: Retrieve value from tasks with amount above the AVG(amount) of projects rows sharing the same id.
SQL:

SELECT value FROM tasks AS catg
WHERE amount > (
    SELECT AVG(amount) FROM projects AS prod
    WHERE prod.id = catg.id
);


Prompt:
Schema:
  projects (alias: ordr)(name, code, type, status)
  accounts(amount, status, level, id)
Task: Find name from projects where level appears in accounts entries with matching level.
SQL:

SELECT name FROM projects AS ordr
WHERE level IN (
    SELECT level FROM accounts AS shp
    WHERE shp.level = ordr.level
);


Prompt:
Schema:
  departments (alias: acct)(date, name, salary, id)
  regions(name, status, date, level)
Task: Retrieve id from departments that have at least one corresponding entry in regions sharing the same status.
SQL:

SELECT id FROM departments AS acct
WHERE EXISTS (
    SELECT 1 FROM regions AS ord
    WHERE ord.status = acct.status
);


Prompt:
Schema:
  customers (alias: emp)(type, value, level, name)
  orders(salary, status, level, name)
Task: Retrieve amount from customers whose id is found in orders rows where level matches the outer record.
SQL:

SELECT amount FROM customers AS emp
WHERE id IN (
    SELECT id FROM orders AS txn
    WHERE txn.level = emp.level
);


Prompt:
Schema:
  projects (alias: schd)(value, date, id, salary)
  employees(salary, type, code, name)
Task: Retrieve value from projects with amount above the MAX(value) of employees rows sharing the same type.
SQL:

SELECT value FROM projects AS schd
WHERE amount > (
    SELECT MAX(value) FROM employees AS cust
    WHERE cust.type = schd.type
);


Prompt:
Schema:
  branches (alias: cust)(id, code, status, level)
  regions(value, id, amount, status)
Task: Find id from branches where a matching record exists in regions with the same level.
SQL:

SELECT id FROM branches AS cust
WHERE EXISTS (
    SELECT 1 FROM regions AS schd
    WHERE schd.level = cust.level
);


Prompt:
Schema:
  shipments (alias: txn)(name, status, type, code)
  regions(value, name, status, level)
Task: Retrieve code from shipments with value above the COUNT(value) of regions rows sharing the same status.
SQL:

SELECT code FROM shipments AS txn
WHERE value > (
    SELECT COUNT(value) FROM regions AS acct
    WHERE acct.status = txn.status
);


Prompt:
Schema:
  projects (alias: catg)(amount, level, code, name)
  regions(level, salary, code, amount)
Task: Find id from projects where salary exceeds the average value from regions for the same id.
SQL:

SELECT id FROM projects AS catg
WHERE salary > (
    SELECT AVG(value) FROM regions AS ord
    WHERE ord.id = catg.id
);


Prompt:
Schema:
  warehouses (alias: emp)(name, status, salary, type)
  suppliers(id, date, code, name)
Task: Find amount from warehouses where a matching record exists in suppliers with the same code.
SQL:

SELECT amount FROM warehouses AS emp
WHERE EXISTS (
    SELECT 1 FROM suppliers AS mgr
    WHERE mgr.code = emp.code
);


Prompt:
Schema:
  products (alias: shp)(id, value, code, name)
  shipments(amount, date, status, value)
Task: Find name from products where id appears in shipments entries with matching code.
SQL:

SELECT name FROM products AS shp
WHERE id IN (
    SELECT id FROM shipments AS schd
    WHERE schd.code = shp.code
);


Prompt:
Schema:
  branches (alias: srvc)(date, id, name, level)
  shipments(date, amount, status, value)
Task: Retrieve name from branches that have at least one corresponding entry in shipments sharing the same id.
SQL:

SELECT name FROM branches AS srvc
WHERE EXISTS (
    SELECT 1 FROM shipments AS sale
    WHERE sale.id = srvc.id
);


Prompt:
Schema:
  regions (alias: whs)(name, status, date, id)
  branches(id, date, amount, value)
Task: Find salary from regions where code appears in branches entries with matching type.
SQL:

SELECT salary FROM regions AS whs
WHERE code IN (
    SELECT code FROM branches AS schd
    WHERE schd.type = whs.type
);


Prompt:
Schema:
  invoices (alias: txn)(code, date, value, status)
  branches(id, value, level, status)
Task: Retrieve id from invoices that have at least one corresponding entry in branches sharing the same status.
SQL:

SELECT id FROM invoices AS txn
WHERE EXISTS (
    SELECT 1 FROM branches AS acct
    WHERE acct.status = txn.status
);


Prompt:
Schema:
  accounts (alias: whs)(value, date, amount, name)
  transactions(salary, amount, level, code)
Task: Find amount from accounts where a matching record exists in transactions with the same level.
SQL:

SELECT amount FROM accounts AS whs
WHERE EXISTS (
    SELECT 1 FROM transactions AS txn
    WHERE txn.level = whs.level
);


Prompt:
Schema:
  warehouses (alias: ord)(status, name, type, value)
  products(amount, salary, level, value)
Task: Find code from warehouses where id appears in products entries with matching level.
SQL:

SELECT code FROM warehouses AS ord
WHERE id IN (
    SELECT id FROM products AS rgn
    WHERE rgn.level = ord.level
);


Prompt:
Schema:
  employees (alias: empl)(salary, type, status, amount)
  accounts(status, name, code, type)
Task: Find value from employees where amount exceeds the average salary from accounts for the same code.
SQL:

SELECT value FROM employees AS empl
WHERE amount > (
    SELECT COUNT(salary) FROM accounts AS rgn
    WHERE rgn.code = empl.code
);


Prompt:
Schema:
  regions (alias: ordr)(status, date, level, value)
  categories(value, name, status, id)
Task: Retrieve id from regions with value above the MAX(value) of categories rows sharing the same type.
SQL:

SELECT id FROM regions AS ordr
WHERE value > (
    SELECT MAX(value) FROM categories AS cust
    WHERE cust.type = ordr.type
);


Prompt:
Schema:
  suppliers (alias: prod)(level, date, type, amount)
  products(salary, date, status, level)
Task: Find salary from suppliers where a matching record exists in products with the same id.
SQL:

SELECT salary FROM suppliers AS prod
WHERE EXISTS (
    SELECT 1 FROM products AS catg
    WHERE catg.id = prod.id
);


Prompt:
Schema:
  invoices (alias: schd)(status, id, level, value)
  transactions(value, amount, type, code)
Task: Retrieve salary from invoices with amount above the SUM(amount) of transactions rows sharing the same status.
SQL:

SELECT salary FROM invoices AS schd
WHERE amount > (
    SELECT SUM(amount) FROM transactions AS shp
    WHERE shp.status = schd.status
);


Prompt:
Schema:
  customers (alias: schd)(name, date, salary, value)
  suppliers(date, name, type, value)
Task: Find amount from customers where status appears in suppliers entries with matching code.
SQL:

SELECT amount FROM customers AS schd
WHERE status IN (
    SELECT status FROM suppliers AS dept
    WHERE dept.code = schd.code
);


Prompt:
Schema:
  transactions (alias: ord)(name, level, type, id)
  products(amount, name, value, status)
Task: Retrieve amount from transactions with salary above the SUM(amount) of products rows sharing the same id.
SQL:

SELECT amount FROM transactions AS ord
WHERE salary > (
    SELECT SUM(amount) FROM products AS budg
    WHERE budg.id = ord.id
);


Prompt:
Schema:
  employees (alias: acct)(code, amount, value, id)
  projects(amount, code, date, level)
Task: Select amount from employees where code exists in projects for the same type.
SQL:

SELECT amount FROM employees AS acct
WHERE code IN (
    SELECT code FROM projects AS cust
    WHERE cust.type = acct.type
);


Prompt:
Schema:
  employees (alias: empl)(salary, level, amount, name)
  projects(id, status, code, level)
Task: Retrieve value from employees that have at least one corresponding entry in projects sharing the same status.
SQL:

SELECT value FROM employees AS empl
WHERE EXISTS (
    SELECT 1 FROM projects AS whs
    WHERE whs.status = empl.status
);


Prompt:
Schema:
  accounts (alias: schd)(type, name, value, amount)
  customers(id, value, type, name)
Task: Retrieve name from accounts whose code is found in customers rows where code matches the outer record.
SQL:

SELECT name FROM accounts AS schd
WHERE code IN (
    SELECT code FROM customers AS acct
    WHERE acct.code = schd.code
);


Prompt:
Schema:
  transactions (alias: dept)(date, value, id, name)
  products(name, status, code, type)
Task: Retrieve code from transactions that have at least one corresponding entry in products sharing the same status.
SQL:

SELECT code FROM transactions AS dept
WHERE EXISTS (
    SELECT 1 FROM products AS ord
    WHERE ord.status = dept.status
);


Prompt:
Schema:
  shipments (alias: catg)(value, salary, amount, type)
  branches(code, level, type, date)
Task: Find value from shipments where code appears in branches entries with matching code.
SQL:

SELECT value FROM shipments AS catg
WHERE code IN (
    SELECT code FROM branches AS prod
    WHERE prod.code = catg.code
);


Prompt:
Schema:
  employees (alias: emp)(code, name, date, id)
  transactions(status, amount, level, salary)
Task: Find salary from employees where a matching record exists in transactions with the same type.
SQL:

SELECT salary FROM employees AS emp
WHERE EXISTS (
    SELECT 1 FROM transactions AS cust
    WHERE cust.type = emp.type
);


Prompt:
Schema:
  products (alias: ord)(status, id, code, amount)
  tasks(name, level, date, type)
Task: Find amount from products where type appears in tasks entries with matching type.
SQL:

SELECT amount FROM products AS ord
WHERE type IN (
    SELECT type FROM tasks AS empl
    WHERE empl.type = ord.type
);


Prompt:
Schema:
  branches (alias: budg)(level, id, date, type)
  invoices(date, status, salary, id)
Task: Find name from branches where value exceeds the average amount from invoices for the same level.
SQL:

SELECT name FROM branches AS budg
WHERE value > (
    SELECT SUM(amount) FROM invoices AS schd
    WHERE schd.level = budg.level
);


Prompt:
Schema:
  shipments (alias: lne)(id, name, status, type)
  branches(date, salary, level, value)
Task: Retrieve amount from shipments with amount above the MAX(value) of branches rows sharing the same status.
SQL:

SELECT amount FROM shipments AS lne
WHERE amount > (
    SELECT MAX(value) FROM branches AS acct
    WHERE acct.status = lne.status
);


Prompt:
Schema:
  regions (alias: rgn)(date, name, status, salary)
  warehouses(id, level, type, date)
Task: Find amount from regions where a matching record exists in warehouses with the same code.
SQL:

SELECT amount FROM regions AS rgn
WHERE EXISTS (
    SELECT 1 FROM warehouses AS ord
    WHERE ord.code = rgn.code
);


Prompt:
Schema:
  departments (alias: txn)(id, date, level, value)
  regions(level, salary, status, type)
Task: Retrieve amount from departments that have at least one corresponding entry in regions sharing the same type.
SQL:

SELECT amount FROM departments AS txn
WHERE EXISTS (
    SELECT 1 FROM regions AS budg
    WHERE budg.type = txn.type
);


Prompt:
Schema:
  customers (alias: empl)(value, amount, level, id)
  branches(id, amount, value, salary)
Task: Find name from customers where code appears in branches entries with matching status.
SQL:

SELECT name FROM customers AS empl
WHERE code IN (
    SELECT code FROM branches AS rgn
    WHERE rgn.status = empl.status
);


Prompt:
Schema:
  invoices (alias: lne)(date, status, code, level)
  categories(type, value, name, salary)
Task: Retrieve salary from invoices whose status is found in categories rows where type matches the outer record.
SQL:

SELECT salary FROM invoices AS lne
WHERE status IN (
    SELECT status FROM categories AS whs
    WHERE whs.type = lne.type
);


Prompt:
Schema:
  branches (alias: rgn)(type, value, level, name)
  regions(value, type, amount, level)
Task: Select name from branches where id exists in regions for the same status.
SQL:

SELECT name FROM branches AS rgn
WHERE id IN (
    SELECT id FROM regions AS sale
    WHERE sale.status = rgn.status
);


Prompt:
Schema:
  customers (alias: txn)(name, level, date, value)
  tasks(code, amount, salary, date)
Task: Find salary from customers where a matching record exists in tasks with the same id.
SQL:

SELECT salary FROM customers AS txn
WHERE EXISTS (
    SELECT 1 FROM tasks AS cust
    WHERE cust.id = txn.id
);


Prompt:
Schema:
  shipments (alias: sale)(value, salary, type, date)
  departments(level, salary, type, code)
Task: Find value from shipments where a matching record exists in departments with the same code.
SQL:

SELECT value FROM shipments AS sale
WHERE EXISTS (
    SELECT 1 FROM departments AS dept
    WHERE dept.code = sale.code
);


Prompt:
Schema:
  departments (alias: rgn)(code, date, salary, status)
  products(name, value, level, date)
Task: Retrieve name from departments that have at least one corresponding entry in products sharing the same code.
SQL:

SELECT name FROM departments AS rgn
WHERE EXISTS (
    SELECT 1 FROM products AS acct
    WHERE acct.code = rgn.code
);


Prompt:
Schema:
  branches (alias: catg)(amount, date, code, salary)
  categories(type, status, code, value)
Task: Find id from branches where amount exceeds the average salary from categories for the same level.
SQL:

SELECT id FROM branches AS catg
WHERE amount > (
    SELECT MIN(salary) FROM categories AS lne
    WHERE lne.level = catg.level
);


Prompt:
Schema:
  warehouses (alias: inv)(date, code, status, id)
  categories(level, amount, value, salary)
Task: Find salary from warehouses where salary exceeds the average value from categories for the same type.
SQL:

SELECT salary FROM warehouses AS inv
WHERE salary > (
    SELECT MIN(value) FROM categories AS dept
    WHERE dept.type = inv.type
);


Prompt:
Schema:
  products (alias: inv)(id, type, status, level)
  accounts(status, value, date, code)
Task: Select name from products where type exists in accounts for the same id.
SQL:

SELECT name FROM products AS inv
WHERE type IN (
    SELECT type FROM accounts AS whs
    WHERE whs.id = inv.id
);


Prompt:
Schema:
  branches (alias: budg)(type, status, code, name)
  projects(date, name, amount, type)
Task: Retrieve code from branches with amount above the AVG(salary) of projects rows sharing the same type.
SQL:

SELECT code FROM branches AS budg
WHERE amount > (
    SELECT AVG(salary) FROM projects AS whs
    WHERE whs.type = budg.type
);


Prompt:
Schema:
  customers (alias: prod)(id, name, amount, value)
  accounts(value, salary, type, date)
Task: Retrieve salary from customers with amount above the MAX(amount) of accounts rows sharing the same level.
SQL:

SELECT salary FROM customers AS prod
WHERE amount > (
    SELECT MAX(amount) FROM accounts AS budg
    WHERE budg.level = prod.level
);


Prompt:
Schema:
  employees (alias: prod)(name, date, type, status)
  tasks(id, name, status, date)
Task: Find amount from employees where type appears in tasks entries with matching level.
SQL:

SELECT amount FROM employees AS prod
WHERE type IN (
    SELECT type FROM tasks AS mgr
    WHERE mgr.level = prod.level
);


Prompt:
Schema:
  branches (alias: cust)(level, value, salary, id)
  projects(type, date, code, amount)
Task: Retrieve amount from branches that have at least one corresponding entry in projects sharing the same type.
SQL:

SELECT amount FROM branches AS cust
WHERE EXISTS (
    SELECT 1 FROM projects AS whs
    WHERE whs.type = cust.type
);


Prompt:
Schema:
  accounts (alias: ord)(amount, name, date, value)
  branches(id, level, code, date)
Task: Retrieve name from accounts that have at least one corresponding entry in branches sharing the same type.
SQL:

SELECT name FROM accounts AS ord
WHERE EXISTS (
    SELECT 1 FROM branches AS inv
    WHERE inv.type = ord.type
);


Prompt:
Schema:
  projects (alias: catg)(amount, status, type, name)
  customers(salary, id, name, code)
Task: Retrieve name from projects that have at least one corresponding entry in customers sharing the same status.
SQL:

SELECT name FROM projects AS catg
WHERE EXISTS (
    SELECT 1 FROM customers AS ord
    WHERE ord.status = catg.status
);


Prompt:
Schema:
  suppliers (alias: schd)(code, type, id, level)
  shipments(code, amount, id, salary)
Task: Retrieve name from suppliers with salary above the AVG(amount) of shipments rows sharing the same id.
SQL:

SELECT name FROM suppliers AS schd
WHERE salary > (
    SELECT AVG(amount) FROM shipments AS txn
    WHERE txn.id = schd.id
);


Prompt:
Schema:
  transactions (alias: prod)(amount, code, level, type)
  regions(level, status, date, value)
Task: Retrieve name from transactions with value above the COUNT(salary) of regions rows sharing the same status.
SQL:

SELECT name FROM transactions AS prod
WHERE value > (
    SELECT COUNT(salary) FROM regions AS inv
    WHERE inv.status = prod.status
);


Prompt:
Schema:
  branches (alias: emp)(type, level, name, status)
  employees(name, date, id, type)
Task: Find code from branches where a matching record exists in employees with the same id.
SQL:

SELECT code FROM branches AS emp
WHERE EXISTS (
    SELECT 1 FROM employees AS txn
    WHERE txn.id = emp.id
);


Prompt:
Schema:
  accounts (alias: budg)(amount, date, status, level)
  employees(value, salary, type, date)
Task: Retrieve code from accounts whose status is found in employees rows where code matches the outer record.
SQL:

SELECT code FROM accounts AS budg
WHERE status IN (
    SELECT status FROM employees AS srvc
    WHERE srvc.code = budg.code
);


Prompt:
Schema:
  categories (alias: acct)(id, amount, status, date)
  projects(type, id, salary, date)
Task: Find id from categories where a matching record exists in projects with the same type.
SQL:

SELECT id FROM categories AS acct
WHERE EXISTS (
    SELECT 1 FROM projects AS lne
    WHERE lne.type = acct.type
);


Prompt:
Schema:
  accounts (alias: txn)(type, code, date, level)
  employees(name, amount, type, code)
Task: Retrieve salary from accounts with salary above the SUM(salary) of employees rows sharing the same status.
SQL:

SELECT salary FROM accounts AS txn
WHERE salary > (
    SELECT SUM(salary) FROM employees AS ord
    WHERE ord.status = txn.status
);


Prompt:
Schema:
  branches (alias: emp)(type, value, salary, level)
  warehouses(amount, salary, id, name)
Task: Find amount from branches where a matching record exists in warehouses with the same status.
SQL:

SELECT amount FROM branches AS emp
WHERE EXISTS (
    SELECT 1 FROM warehouses AS lne
    WHERE lne.status = emp.status
);


Prompt:
Schema:
  employees (alias: prod)(status, salary, level, code)
  customers(value, level, salary, name)
Task: Retrieve amount from employees with amount above the AVG(amount) of customers rows sharing the same status.
SQL:

SELECT amount FROM employees AS prod
WHERE amount > (
    SELECT AVG(amount) FROM customers AS whs
    WHERE whs.status = prod.status
);


Prompt:
Schema:
  tasks (alias: ordr)(date, value, amount, type)
  shipments(salary, date, value, level)
Task: Find id from tasks where a matching record exists in shipments with the same id.
SQL:

SELECT id FROM tasks AS ordr
WHERE EXISTS (
    SELECT 1 FROM shipments AS dept
    WHERE dept.id = ordr.id
);


Prompt:
Schema:
  employees (alias: mgr)(salary, status, date, amount)
  categories(status, type, id, salary)
Task: Retrieve value from employees that have at least one corresponding entry in categories sharing the same type.
SQL:

SELECT value FROM employees AS mgr
WHERE EXISTS (
    SELECT 1 FROM categories AS txn
    WHERE txn.type = mgr.type
);


Prompt:
Schema:
  projects (alias: lne)(id, date, amount, level)
  orders(salary, level, date, name)
Task: Find name from projects where status appears in orders entries with matching id.
SQL:

SELECT name FROM projects AS lne
WHERE status IN (
    SELECT status FROM orders AS acct
    WHERE acct.id = lne.id
);


Prompt:
Schema:
  departments (alias: whs)(value, name, date, status)
  customers(code, salary, status, date)
Task: Find amount from departments where amount exceeds the average salary from customers for the same code.
SQL:

SELECT amount FROM departments AS whs
WHERE amount > (
    SELECT MAX(salary) FROM customers AS sale
    WHERE sale.code = whs.code
);


Prompt:
Schema:
  projects (alias: schd)(value, status, type, amount)
  invoices(level, amount, id, value)
Task: Retrieve value from projects that have at least one corresponding entry in invoices sharing the same code.
SQL:

SELECT value FROM projects AS schd
WHERE EXISTS (
    SELECT 1 FROM invoices AS empl
    WHERE empl.code = schd.code
);


Prompt:
Schema:
  products (alias: ordr)(status, code, date, id)
  employees(id, level, status, type)
Task: Find amount from products where salary exceeds the average amount from employees for the same status.
SQL:

SELECT amount FROM products AS ordr
WHERE salary > (
    SELECT MAX(amount) FROM employees AS catg
    WHERE catg.status = ordr.status
);


Prompt:
Schema:
  shipments (alias: lne)(code, status, amount, level)
  employees(level, type, amount, value)
Task: Retrieve name from shipments whose id is found in employees rows where status matches the outer record.
SQL:

SELECT name FROM shipments AS lne
WHERE id IN (
    SELECT id FROM employees AS emp
    WHERE emp.status = lne.status
);


Prompt:
Schema:
  employees (alias: catg)(level, salary, type, id)
  shipments(id, status, salary, amount)
Task: Find code from employees where a matching record exists in shipments with the same id.
SQL:

SELECT code FROM employees AS catg
WHERE EXISTS (
    SELECT 1 FROM shipments AS empl
    WHERE empl.id = catg.id
);


Prompt:
Schema:
  tasks (alias: ordr)(value, date, type, code)
  categories(status, date, level, name)
Task: Retrieve code from tasks that have at least one corresponding entry in categories sharing the same code.
SQL:

SELECT code FROM tasks AS ordr
WHERE EXISTS (
    SELECT 1 FROM categories AS prod
    WHERE prod.code = ordr.code
);


Prompt:
Schema:
  regions (alias: inv)(date, value, status, name)
  invoices(type, status, id, date)
Task: Retrieve id from regions whose type is found in invoices rows where type matches the outer record.
SQL:

SELECT id FROM regions AS inv
WHERE type IN (
    SELECT type FROM invoices AS empl
    WHERE empl.type = inv.type
);


Prompt:
Schema:
  employees (alias: rgn)(id, salary, value, name)
  orders(date, salary, status, id)
Task: Retrieve name from employees with value above the MIN(salary) of orders rows sharing the same type.
SQL:

SELECT name FROM employees AS rgn
WHERE value > (
    SELECT MIN(salary) FROM orders AS ordr
    WHERE ordr.type = rgn.type
);


Prompt:
Schema:
  transactions (alias: sale)(name, status, date, amount)
  tasks(level, status, salary, id)
Task: Retrieve code from transactions whose status is found in tasks rows where code matches the outer record.
SQL:

SELECT code FROM transactions AS sale
WHERE status IN (
    SELECT status FROM tasks AS mgr
    WHERE mgr.code = sale.code
);


Prompt:
Schema:
  accounts (alias: rgn)(salary, amount, value, code)
  tasks(amount, code, salary, value)
Task: Select id from accounts where level exists in tasks for the same level.
SQL:

SELECT id FROM accounts AS rgn
WHERE level IN (
    SELECT level FROM tasks AS srvc
    WHERE srvc.level = rgn.level
);


Prompt:
Schema:
  suppliers (alias: rgn)(type, code, salary, date)
  departments(salary, amount, date, code)
Task: Find salary from suppliers where salary exceeds the average salary from departments for the same level.
SQL:

SELECT salary FROM suppliers AS rgn
WHERE salary > (
    SELECT MAX(salary) FROM departments AS schd
    WHERE schd.level = rgn.level
);


Prompt:
Schema:
  shipments (alias: inv)(date, level, value, salary)
  regions(value, salary, id, name)
Task: Retrieve id from shipments with value above the AVG(salary) of regions rows sharing the same id.
SQL:

SELECT id FROM shipments AS inv
WHERE value > (
    SELECT AVG(salary) FROM regions AS whs
    WHERE whs.id = inv.id
);


Prompt:
Schema:
  products (alias: txn)(amount, id, date, code)
  shipments(id, amount, type, salary)
Task: Select id from products where level exists in shipments for the same id.
SQL:

SELECT id FROM products AS txn
WHERE level IN (
    SELECT level FROM shipments AS empl
    WHERE empl.id = txn.id
);


Prompt:
Schema:
  accounts (alias: whs)(value, status, id, level)
  shipments(date, value, code, status)
Task: Find code from accounts where salary exceeds the average value from shipments for the same id.
SQL:

SELECT code FROM accounts AS whs
WHERE salary > (
    SELECT MIN(value) FROM shipments AS rgn
    WHERE rgn.id = whs.id
);


Prompt:
Schema:
  warehouses (alias: ordr)(date, amount, salary, id)
  departments(value, code, name, level)
Task: Find value from warehouses where a matching record exists in departments with the same id.
SQL:

SELECT value FROM warehouses AS ordr
WHERE EXISTS (
    SELECT 1 FROM departments AS srvc
    WHERE srvc.id = ordr.id
);


Prompt:
Schema:
  suppliers (alias: inv)(status, date, code, salary)
  projects(date, name, id, code)
Task: Select id from suppliers where code exists in projects for the same type.
SQL:

SELECT id FROM suppliers AS inv
WHERE code IN (
    SELECT code FROM projects AS cust
    WHERE cust.type = inv.type
);


Prompt:
Schema:
  invoices (alias: mgr)(name, date, id, code)
  tasks(code, level, salary, status)
Task: Select salary from invoices where code exists in tasks for the same code.
SQL:

SELECT salary FROM invoices AS mgr
WHERE code IN (
    SELECT code FROM tasks AS empl
    WHERE empl.code = mgr.code
);


Prompt:
Schema:
  customers (alias: empl)(code, amount, type, value)
  orders(code, type, amount, status)
Task: Retrieve id from customers that have at least one corresponding entry in orders sharing the same id.
SQL:

SELECT id FROM customers AS empl
WHERE EXISTS (
    SELECT 1 FROM orders AS cust
    WHERE cust.id = empl.id
);


Prompt:
Schema:
  shipments (alias: sale)(salary, amount, date, type)
  customers(amount, level, type, name)
Task: Find name from shipments where salary exceeds the average salary from customers for the same status.
SQL:

SELECT name FROM shipments AS sale
WHERE salary > (
    SELECT MAX(salary) FROM customers AS txn
    WHERE txn.status = sale.status
);


Prompt:
Schema:
  regions (alias: shp)(name, status, type, date)
  categories(type, name, code, level)
Task: Retrieve code from regions that have at least one corresponding entry in categories sharing the same id.
SQL:

SELECT code FROM regions AS shp
WHERE EXISTS (
    SELECT 1 FROM categories AS empl
    WHERE empl.id = shp.id
);


Prompt:
Schema:
  projects (alias: inv)(level, code, name, id)
  products(status, type, date, amount)
Task: Find value from projects where amount exceeds the average value from products for the same code.
SQL:

SELECT value FROM projects AS inv
WHERE amount > (
    SELECT COUNT(value) FROM products AS srvc
    WHERE srvc.code = inv.code
);


Prompt:
Schema:
  projects (alias: lne)(code, name, amount, status)
  warehouses(id, level, salary, value)
Task: Find salary from projects where a matching record exists in warehouses with the same level.
SQL:

SELECT salary FROM projects AS lne
WHERE EXISTS (
    SELECT 1 FROM warehouses AS cust
    WHERE cust.level = lne.level
);


Prompt:
Schema:
  tasks (alias: srvc)(date, type, level, code)
  departments(amount, name, id, code)
Task: Retrieve name from tasks that have at least one corresponding entry in departments sharing the same status.
SQL:

SELECT name FROM tasks AS srvc
WHERE EXISTS (
    SELECT 1 FROM departments AS rgn
    WHERE rgn.status = srvc.status
);


Prompt:
Schema:
  branches (alias: srvc)(name, code, salary, date)
  shipments(value, code, name, status)
Task: Find code from branches where type appears in shipments entries with matching type.
SQL:

SELECT code FROM branches AS srvc
WHERE type IN (
    SELECT type FROM shipments AS emp
    WHERE emp.type = srvc.type
);


Prompt:
Schema:
  employees (alias: shp)(name, level, value, date)
  customers(amount, code, value, level)
Task: Retrieve amount from employees with value above the MAX(salary) of customers rows sharing the same type.
SQL:

SELECT amount FROM employees AS shp
WHERE value > (
    SELECT MAX(salary) FROM customers AS inv
    WHERE inv.type = shp.type
);


Prompt:
Schema:
  employees (alias: shp)(id, value, level, type)
  tasks(code, level, type, date)
Task: Find amount from employees where a matching record exists in tasks with the same level.
SQL:

SELECT amount FROM employees AS shp
WHERE EXISTS (
    SELECT 1 FROM tasks AS empl
    WHERE empl.level = shp.level
);


Prompt:
Schema:
  transactions (alias: ordr)(id, value, type, level)
  invoices(value, amount, name, id)
Task: Retrieve id from transactions with value above the MIN(salary) of invoices rows sharing the same level.
SQL:

SELECT id FROM transactions AS ordr
WHERE value > (
    SELECT MIN(salary) FROM invoices AS schd
    WHERE schd.level = ordr.level
);


Prompt:
Schema:
  products (alias: empl)(value, id, level, status)
  shipments(amount, value, status, id)
Task: Retrieve id from products with value above the SUM(amount) of shipments rows sharing the same code.
SQL:

SELECT id FROM products AS empl
WHERE value > (
    SELECT SUM(amount) FROM shipments AS whs
    WHERE whs.code = empl.code
);


Prompt:
Schema:
  projects (alias: dept)(name, status, value, id)
  accounts(id, salary, code, name)
Task: Find salary from projects where code appears in accounts entries with matching id.
SQL:

SELECT salary FROM projects AS dept
WHERE code IN (
    SELECT code FROM accounts AS budg
    WHERE budg.id = dept.id
);


Prompt:
Schema:
  regions (alias: mgr)(name, type, value, salary)
  customers(amount, status, type, name)
Task: Retrieve salary from regions that have at least one corresponding entry in customers sharing the same status.
SQL:

SELECT salary FROM regions AS mgr
WHERE EXISTS (
    SELECT 1 FROM customers AS rgn
    WHERE rgn.status = mgr.status
);


Prompt:
Schema:
  customers (alias: empl)(type, status, name, date)
  categories(date, value, type, name)
Task: Find id from customers where salary exceeds the average amount from categories for the same id.
SQL:

SELECT id FROM customers AS empl
WHERE salary > (
    SELECT SUM(amount) FROM categories AS mgr
    WHERE mgr.id = empl.id
);


Prompt:
Schema:
  transactions (alias: ord)(level, type, id, name)
  departments(value, type, amount, status)
Task: Find code from transactions where id appears in departments entries with matching level.
SQL:

SELECT code FROM transactions AS ord
WHERE id IN (
    SELECT id FROM departments AS catg
    WHERE catg.level = ord.level
);


Prompt:
Schema:
  shipments (alias: ordr)(value, name, status, date)
  transactions(name, amount, type, status)
Task: Find code from shipments where amount exceeds the average salary from transactions for the same status.
SQL:

SELECT code FROM shipments AS ordr
WHERE amount > (
    SELECT COUNT(salary) FROM transactions AS prod
    WHERE prod.status = ordr.status
);


Prompt:
Schema:
  branches (alias: whs)(type, value, id, status)
  orders(id, code, value, salary)
Task: Retrieve value from branches that have at least one corresponding entry in orders sharing the same type.
SQL:

SELECT value FROM branches AS whs
WHERE EXISTS (
    SELECT 1 FROM orders AS catg
    WHERE catg.type = whs.type
);


Prompt:
Schema:
  invoices (alias: acct)(id, level, status, salary)
  orders(amount, salary, status, date)
Task: Retrieve code from invoices that have at least one corresponding entry in orders sharing the same level.
SQL:

SELECT code FROM invoices AS acct
WHERE EXISTS (
    SELECT 1 FROM orders AS ordr
    WHERE ordr.level = acct.level
);


Prompt:
Schema:
  orders (alias: sale)(level, name, value, type)
  employees(amount, name, type, salary)
Task: Find name from orders where a matching record exists in employees with the same id.
SQL:

SELECT name FROM orders AS sale
WHERE EXISTS (
    SELECT 1 FROM employees AS dept
    WHERE dept.id = sale.id
);


Prompt:
Schema:
  branches (alias: txn)(name, level, status, salary)
  tasks(type, level, status, id)
Task: Find name from branches where amount exceeds the average amount from tasks for the same code.
SQL:

SELECT name FROM branches AS txn
WHERE amount > (
    SELECT SUM(amount) FROM tasks AS whs
    WHERE whs.code = txn.code
);


Prompt:
Schema:
  suppliers (alias: empl)(id, status, level, amount)
  employees(status, amount, level, name)
Task: Retrieve code from suppliers with amount above the AVG(salary) of employees rows sharing the same id.
SQL:

SELECT code FROM suppliers AS empl
WHERE amount > (
    SELECT AVG(salary) FROM employees AS schd
    WHERE schd.id = empl.id
);


Prompt:
Schema:
  employees (alias: ord)(date, name, level, type)
  invoices(id, level, name, status)
Task: Retrieve name from employees with amount above the MAX(salary) of invoices rows sharing the same type.
SQL:

SELECT name FROM employees AS ord
WHERE amount > (
    SELECT MAX(salary) FROM invoices AS catg
    WHERE catg.type = ord.type
);


Prompt:
Schema:
  categories (alias: whs)(type, date, status, level)
  projects(status, id, code, name)
Task: Retrieve salary from categories that have at least one corresponding entry in projects sharing the same type.
SQL:

SELECT salary FROM categories AS whs
WHERE EXISTS (
    SELECT 1 FROM projects AS dept
    WHERE dept.type = whs.type
);


Prompt:
Schema:
  products (alias: whs)(value, status, level, type)
  categories(amount, status, salary, name)
Task: Find amount from products where a matching record exists in categories with the same type.
SQL:

SELECT amount FROM products AS whs
WHERE EXISTS (
    SELECT 1 FROM categories AS budg
    WHERE budg.type = whs.type
);


Prompt:
Schema:
  shipments (alias: ord)(salary, date, amount, name)
  branches(level, status, salary, id)
Task: Find code from shipments where salary exceeds the average value from branches for the same id.
SQL:

SELECT code FROM shipments AS ord
WHERE salary > (
    SELECT AVG(value) FROM branches AS empl
    WHERE empl.id = ord.id
);


Prompt:
Schema:
  branches (alias: shp)(name, id, amount, salary)
  employees(date, salary, id, status)
Task: Retrieve name from branches whose level is found in employees rows where status matches the outer record.
SQL:

SELECT name FROM branches AS shp
WHERE level IN (
    SELECT level FROM employees AS empl
    WHERE empl.status = shp.status
);


Prompt:
Schema:
  employees (alias: shp)(code, date, level, value)
  tasks(level, amount, type, name)
Task: Find code from employees where a matching record exists in tasks with the same id.
SQL:

SELECT code FROM employees AS shp
WHERE EXISTS (
    SELECT 1 FROM tasks AS ord
    WHERE ord.id = shp.id
);


Prompt:
Schema:
  shipments (alias: lne)(code, date, value, status)
  categories(salary, value, id, date)
Task: Find name from shipments where amount exceeds the average amount from categories for the same code.
SQL:

SELECT name FROM shipments AS lne
WHERE amount > (
    SELECT MAX(amount) FROM categories AS srvc
    WHERE srvc.code = lne.code
);


Prompt:
Schema:
  customers (alias: txn)(salary, level, id, value)
  shipments(name, value, code, level)
Task: Retrieve salary from customers whose status is found in shipments rows where type matches the outer record.
SQL:

SELECT salary FROM customers AS txn
WHERE status IN (
    SELECT status FROM shipments AS emp
    WHERE emp.type = txn.type
);


Prompt:
Schema:
  transactions (alias: srvc)(salary, value, amount, type)
  departments(status, level, type, date)
Task: Find amount from transactions where a matching record exists in departments with the same id.
SQL:

SELECT amount FROM transactions AS srvc
WHERE EXISTS (
    SELECT 1 FROM departments AS shp
    WHERE shp.id = srvc.id
);


Prompt:
Schema:
  products (alias: inv)(date, name, type, amount)
  accounts(date, id, amount, code)
Task: Find amount from products where code appears in accounts entries with matching status.
SQL:

SELECT amount FROM products AS inv
WHERE code IN (
    SELECT code FROM accounts AS prod
    WHERE prod.status = inv.status
);


Prompt:
Schema:
  transactions (alias: empl)(code, value, name, date)
  orders(value, status, date, type)
Task: Find code from transactions where id appears in orders entries with matching level.
SQL:

SELECT code FROM transactions AS empl
WHERE id IN (
    SELECT id FROM orders AS lne
    WHERE lne.level = empl.level
);


Prompt:
Schema:
  suppliers (alias: budg)(code, name, value, status)
  tasks(name, amount, value, code)
Task: Find amount from suppliers where a matching record exists in tasks with the same type.
SQL:

SELECT amount FROM suppliers AS budg
WHERE EXISTS (
    SELECT 1 FROM tasks AS acct
    WHERE acct.type = budg.type
);


Prompt:
Schema:
  suppliers (alias: ord)(name, id, salary, value)
  orders(name, level, code, salary)
Task: Find salary from suppliers where value exceeds the average salary from orders for the same id.
SQL:

SELECT salary FROM suppliers AS ord
WHERE value > (
    SELECT SUM(salary) FROM orders AS whs
    WHERE whs.id = ord.id
);


Prompt:
Schema:
  transactions (alias: rgn)(name, value, type, date)
  customers(value, amount, level, code)
Task: Retrieve id from transactions that have at least one corresponding entry in customers sharing the same id.
SQL:

SELECT id FROM transactions AS rgn
WHERE EXISTS (
    SELECT 1 FROM customers AS catg
    WHERE catg.id = rgn.id
);


Prompt:
Schema:
  categories (alias: inv)(level, type, status, name)
  customers(amount, level, name, code)
Task: Retrieve code from categories whose level is found in customers rows where level matches the outer record.
SQL:

SELECT code FROM categories AS inv
WHERE level IN (
    SELECT level FROM customers AS emp
    WHERE emp.level = inv.level
);


Prompt:
Schema:
  transactions (alias: inv)(code, amount, name, level)
  orders(code, type, id, date)
Task: Find id from transactions where level appears in orders entries with matching code.
SQL:

SELECT id FROM transactions AS inv
WHERE level IN (
    SELECT level FROM orders AS emp
    WHERE emp.code = inv.code
);


Prompt:
Schema:
  tasks (alias: inv)(id, level, name, type)
  accounts(id, type, level, salary)
Task: Find salary from tasks where value exceeds the average salary from accounts for the same status.
SQL:

SELECT salary FROM tasks AS inv
WHERE value > (
    SELECT MIN(salary) FROM accounts AS empl
    WHERE empl.status = inv.status
);


Prompt:
Schema:
  categories (alias: mgr)(amount, name, code, value)
  shipments(amount, id, salary, date)
Task: Retrieve id from categories that have at least one corresponding entry in shipments sharing the same code.
SQL:

SELECT id FROM categories AS mgr
WHERE EXISTS (
    SELECT 1 FROM shipments AS empl
    WHERE empl.code = mgr.code
);


Prompt:
Schema:
  categories (alias: prod)(type, status, amount, value)
  projects(value, level, status, id)
Task: Retrieve code from categories that have at least one corresponding entry in projects sharing the same status.
SQL:

SELECT code FROM categories AS prod
WHERE EXISTS (
    SELECT 1 FROM projects AS shp
    WHERE shp.status = prod.status
);


Prompt:
Schema:
  regions (alias: srvc)(code, id, date, value)
  warehouses(status, code, id, type)
Task: Find value from regions where amount exceeds the average salary from warehouses for the same code.
SQL:

SELECT value FROM regions AS srvc
WHERE amount > (
    SELECT AVG(salary) FROM warehouses AS schd
    WHERE schd.code = srvc.code
);


Prompt:
Schema:
  suppliers (alias: ord)(amount, salary, id, name)
  customers(id, amount, name, level)
Task: Retrieve amount from suppliers with amount above the SUM(salary) of customers rows sharing the same id.
SQL:

SELECT amount FROM suppliers AS ord
WHERE amount > (
    SELECT SUM(salary) FROM customers AS sale
    WHERE sale.id = ord.id
);


Prompt:
Schema:
  projects (alias: shp)(id, value, level, amount)
  categories(name, value, type, date)
Task: Find code from projects where salary exceeds the average amount from categories for the same code.
SQL:

SELECT code FROM projects AS shp
WHERE salary > (
    SELECT AVG(amount) FROM categories AS empl
    WHERE empl.code = shp.code
);


Prompt:
Schema:
  warehouses (alias: cust)(code, type, value, salary)
  transactions(code, id, salary, level)
Task: Select code from warehouses where id exists in transactions for the same id.
SQL:

SELECT code FROM warehouses AS cust
WHERE id IN (
    SELECT id FROM transactions AS emp
    WHERE emp.id = cust.id
);


Prompt:
Schema:
  employees (alias: catg)(value, level, code, date)
  products(type, id, amount, code)
Task: Retrieve code from employees with salary above the AVG(amount) of products rows sharing the same level.
SQL:

SELECT code FROM employees AS catg
WHERE salary > (
    SELECT AVG(amount) FROM products AS emp
    WHERE emp.level = catg.level
);


Prompt:
Schema:
  warehouses (alias: shp)(name, amount, salary, value)
  accounts(amount, level, name, type)
Task: Find salary from warehouses where value exceeds the average value from accounts for the same id.
SQL:

SELECT salary FROM warehouses AS shp
WHERE value > (
    SELECT AVG(value) FROM accounts AS cust
    WHERE cust.id = shp.id
);


Prompt:
Schema:
  projects (alias: txn)(date, level, salary, amount)
  customers(id, name, amount, salary)
Task: Retrieve value from projects with amount above the MAX(salary) of customers rows sharing the same status.
SQL:

SELECT value FROM projects AS txn
WHERE amount > (
    SELECT MAX(salary) FROM customers AS cust
    WHERE cust.status = txn.status
);


Prompt:
Schema:
  shipments (alias: srvc)(code, amount, date, name)
  customers(amount, date, salary, type)
Task: Find value from shipments where value exceeds the average salary from customers for the same code.
SQL:

SELECT value FROM shipments AS srvc
WHERE value > (
    SELECT AVG(salary) FROM customers AS schd
    WHERE schd.code = srvc.code
);


Prompt:
Schema:
  tasks (alias: ord)(id, amount, type, name)
  invoices(date, name, id, code)
Task: Retrieve amount from tasks that have at least one corresponding entry in invoices sharing the same type.
SQL:

SELECT amount FROM tasks AS ord
WHERE EXISTS (
    SELECT 1 FROM invoices AS empl
    WHERE empl.type = ord.type
);


Prompt:
Schema:
  suppliers (alias: mgr)(name, code, value, date)
  shipments(salary, code, amount, status)
Task: Select value from suppliers where code exists in shipments for the same level.
SQL:

SELECT value FROM suppliers AS mgr
WHERE code IN (
    SELECT code FROM shipments AS txn
    WHERE txn.level = mgr.level
);


Prompt:
Schema:
  shipments (alias: schd)(code, value, type, name)
  invoices(status, type, name, level)
Task: Retrieve salary from shipments with value above the MAX(amount) of invoices rows sharing the same type.
SQL:

SELECT salary FROM shipments AS schd
WHERE value > (
    SELECT MAX(amount) FROM invoices AS catg
    WHERE catg.type = schd.type
);


Prompt:
Schema:
  categories (alias: srvc)(amount, code, name, value)
  branches(value, level, status, id)
Task: Retrieve amount from categories that have at least one corresponding entry in branches sharing the same type.
SQL:

SELECT amount FROM categories AS srvc
WHERE EXISTS (
    SELECT 1 FROM branches AS ordr
    WHERE ordr.type = srvc.type
);


Prompt:
Schema:
  warehouses (alias: catg)(amount, level, name, code)
  invoices(amount, code, salary, level)
Task: Find amount from warehouses where a matching record exists in invoices with the same status.
SQL:

SELECT amount FROM warehouses AS catg
WHERE EXISTS (
    SELECT 1 FROM invoices AS srvc
    WHERE srvc.status = catg.status
);


Prompt:
Schema:
  customers (alias: sale)(id, status, date, code)
  categories(amount, salary, value, status)
Task: Select salary from customers where type exists in categories for the same code.
SQL:

SELECT salary FROM customers AS sale
WHERE type IN (
    SELECT type FROM categories AS budg
    WHERE budg.code = sale.code
);


Prompt:
Schema:
  invoices (alias: acct)(code, id, salary, amount)
  employees(salary, date, level, name)
Task: Select name from invoices where id exists in employees for the same id.
SQL:

SELECT name FROM invoices AS acct
WHERE id IN (
    SELECT id FROM employees AS emp
    WHERE emp.id = acct.id
);


Prompt:
Schema:
  products (alias: dept)(amount, level, code, value)
  categories(code, date, value, salary)
Task: Find name from products where a matching record exists in categories with the same status.
SQL:

SELECT name FROM products AS dept
WHERE EXISTS (
    SELECT 1 FROM categories AS whs
    WHERE whs.status = dept.status
);


Prompt:
Schema:
  shipments (alias: sale)(id, status, value, type)
  warehouses(level, salary, type, id)
Task: Retrieve name from shipments with salary above the SUM(amount) of warehouses rows sharing the same code.
SQL:

SELECT name FROM shipments AS sale
WHERE salary > (
    SELECT SUM(amount) FROM warehouses AS budg
    WHERE budg.code = sale.code
);


Prompt:
Schema:
  invoices (alias: shp)(id, status, type, date)
  departments(status, date, type, amount)
Task: Retrieve value from invoices whose code is found in departments rows where id matches the outer record.
SQL:

SELECT value FROM invoices AS shp
WHERE code IN (
    SELECT code FROM departments AS lne
    WHERE lne.id = shp.id
);


Prompt:
Schema:
  tasks (alias: whs)(status, salary, id, value)
  suppliers(type, id, status, amount)
Task: Retrieve name from tasks that have at least one corresponding entry in suppliers sharing the same id.
SQL:

SELECT name FROM tasks AS whs
WHERE EXISTS (
    SELECT 1 FROM suppliers AS rgn
    WHERE rgn.id = whs.id
);


Prompt:
Schema:
  branches (alias: lne)(amount, date, status, id)
  customers(level, value, salary, id)
Task: Select id from branches where status exists in customers for the same status.
SQL:

SELECT id FROM branches AS lne
WHERE status IN (
    SELECT status FROM customers AS ordr
    WHERE ordr.status = lne.status
);


Prompt:
Schema:
  departments (alias: srvc)(status, code, type, value)
  invoices(amount, level, name, id)
Task: Retrieve id from departments that have at least one corresponding entry in invoices sharing the same type.
SQL:

SELECT id FROM departments AS srvc
WHERE EXISTS (
    SELECT 1 FROM invoices AS mgr
    WHERE mgr.type = srvc.type
);


Prompt:
Schema:
  tasks (alias: ordr)(id, value, date, type)
  employees(salary, name, type, id)
Task: Retrieve id from tasks with amount above the MIN(amount) of employees rows sharing the same code.
SQL:

SELECT id FROM tasks AS ordr
WHERE amount > (
    SELECT MIN(amount) FROM employees AS sale
    WHERE sale.code = ordr.code
);


Prompt:
Schema:
  categories (alias: ord)(salary, level, id, name)
  accounts(level, name, salary, type)
Task: Find name from categories where value exceeds the average amount from accounts for the same level.
SQL:

SELECT name FROM categories AS ord
WHERE value > (
    SELECT MAX(amount) FROM accounts AS sale
    WHERE sale.level = ord.level
);


Prompt:
Schema:
  employees (alias: empl)(code, id, salary, level)
  warehouses(status, level, id, type)
Task: Find id from employees where a matching record exists in warehouses with the same id.
SQL:

SELECT id FROM employees AS empl
WHERE EXISTS (
    SELECT 1 FROM warehouses AS dept
    WHERE dept.id = empl.id
);


Prompt:
Schema:
  employees (alias: sale)(id, amount, value, name)
  suppliers(level, type, value, date)
Task: Retrieve value from employees whose id is found in suppliers rows where id matches the outer record.
SQL:

SELECT value FROM employees AS sale
WHERE id IN (
    SELECT id FROM suppliers AS ord
    WHERE ord.id = sale.id
);


Prompt:
Schema:
  tasks (alias: whs)(amount, id, level, value)
  transactions(type, date, value, level)
Task: Select salary from tasks where level exists in transactions for the same id.
SQL:

SELECT salary FROM tasks AS whs
WHERE level IN (
    SELECT level FROM transactions AS emp
    WHERE emp.id = whs.id
);


Prompt:
Schema:
  customers (alias: shp)(value, id, code, amount)
  transactions(date, amount, code, name)
Task: Retrieve id from customers whose level is found in transactions rows where status matches the outer record.
SQL:

SELECT id FROM customers AS shp
WHERE level IN (
    SELECT level FROM transactions AS emp
    WHERE emp.status = shp.status
);


Prompt:
Schema:
  projects (alias: dept)(name, level, date, id)
  categories(id, type, amount, value)
Task: Find value from projects where a matching record exists in categories with the same code.
SQL:

SELECT value FROM projects AS dept
WHERE EXISTS (
    SELECT 1 FROM categories AS ord
    WHERE ord.code = dept.code
);


Prompt:
Schema:
  branches (alias: catg)(value, status, type, salary)
  products(type, value, salary, date)
Task: Retrieve amount from branches that have at least one corresponding entry in products sharing the same level.
SQL:

SELECT amount FROM branches AS catg
WHERE EXISTS (
    SELECT 1 FROM products AS ord
    WHERE ord.level = catg.level
);


Prompt:
Schema:
  invoices (alias: whs)(status, level, date, type)
  transactions(name, id, amount, level)
Task: Retrieve id from invoices that have at least one corresponding entry in transactions sharing the same type.
SQL:

SELECT id FROM invoices AS whs
WHERE EXISTS (
    SELECT 1 FROM transactions AS schd
    WHERE schd.type = whs.type
);


Prompt:
Schema:
  regions (alias: budg)(value, salary, status, id)
  shipments(name, amount, date, id)
Task: Find salary from regions where a matching record exists in shipments with the same level.
SQL:

SELECT salary FROM regions AS budg
WHERE EXISTS (
    SELECT 1 FROM shipments AS rgn
    WHERE rgn.level = budg.level
);


Prompt:
Schema:
  invoices (alias: dept)(name, code, salary, amount)
  suppliers(type, name, id, level)
Task: Find id from invoices where salary exceeds the average salary from suppliers for the same type.
SQL:

SELECT id FROM invoices AS dept
WHERE salary > (
    SELECT AVG(salary) FROM suppliers AS ord
    WHERE ord.type = dept.type
);


Prompt:
Schema:
  accounts (alias: ordr)(amount, status, id, type)
  projects(type, level, status, value)
Task: Retrieve salary from accounts that have at least one corresponding entry in projects sharing the same level.
SQL:

SELECT salary FROM accounts AS ordr
WHERE EXISTS (
    SELECT 1 FROM projects AS mgr
    WHERE mgr.level = ordr.level
);


Prompt:
Schema:
  suppliers (alias: shp)(amount, date, code, value)
  invoices(value, id, code, salary)
Task: Retrieve amount from suppliers whose level is found in invoices rows where id matches the outer record.
SQL:

SELECT amount FROM suppliers AS shp
WHERE level IN (
    SELECT level FROM invoices AS prod
    WHERE prod.id = shp.id
);


Prompt:
Schema:
  regions (alias: mgr)(status, value, level, date)
  orders(date, type, name, id)
Task: Find id from regions where amount exceeds the average value from orders for the same type.
SQL:

SELECT id FROM regions AS mgr
WHERE amount > (
    SELECT SUM(value) FROM orders AS sale
    WHERE sale.type = mgr.type
);


Prompt:
Schema:
  suppliers (alias: shp)(salary, id, amount, type)
  warehouses(salary, amount, id, level)
Task: Retrieve salary from suppliers that have at least one corresponding entry in warehouses sharing the same level.
SQL:

SELECT salary FROM suppliers AS shp
WHERE EXISTS (
    SELECT 1 FROM warehouses AS prod
    WHERE prod.level = shp.level
);


Prompt:
Schema:
  departments (alias: whs)(amount, status, code, salary)
  employees(type, code, date, value)
Task: Retrieve salary from departments with salary above the MIN(salary) of employees rows sharing the same level.
SQL:

SELECT salary FROM departments AS whs
WHERE salary > (
    SELECT MIN(salary) FROM employees AS empl
    WHERE empl.level = whs.level
);


Prompt:
Schema:
  tasks (alias: lne)(code, date, name, status)
  projects(id, salary, code, date)
Task: Retrieve salary from tasks with amount above the COUNT(salary) of projects rows sharing the same level.
SQL:

SELECT salary FROM tasks AS lne
WHERE amount > (
    SELECT COUNT(salary) FROM projects AS empl
    WHERE empl.level = lne.level
);


Prompt:
Schema:
  employees (alias: srvc)(id, date, type, name)
  orders(salary, code, value, date)
Task: Find name from employees where a matching record exists in orders with the same status.
SQL:

SELECT name FROM employees AS srvc
WHERE EXISTS (
    SELECT 1 FROM orders AS empl
    WHERE empl.status = srvc.status
);


Prompt:
Schema:
  shipments (alias: cust)(code, amount, date, salary)
  warehouses(id, salary, amount, type)
Task: Find id from shipments where a matching record exists in warehouses with the same status.
SQL:

SELECT id FROM shipments AS cust
WHERE EXISTS (
    SELECT 1 FROM warehouses AS catg
    WHERE catg.status = cust.status
);


Prompt:
Schema:
  warehouses (alias: mgr)(value, date, code, salary)
  accounts(name, value, amount, date)
Task: Retrieve amount from warehouses that have at least one corresponding entry in accounts sharing the same status.
SQL:

SELECT amount FROM warehouses AS mgr
WHERE EXISTS (
    SELECT 1 FROM accounts AS shp
    WHERE shp.status = mgr.status
);


Prompt:
Schema:
  accounts (alias: dept)(code, status, date, salary)
  products(salary, amount, type, status)
Task: Retrieve code from accounts that have at least one corresponding entry in products sharing the same code.
SQL:

SELECT code FROM accounts AS dept
WHERE EXISTS (
    SELECT 1 FROM products AS prod
    WHERE prod.code = dept.code
);


Prompt:
Schema:
  orders (alias: mgr)(status, date, amount, salary)
  employees(code, salary, id, status)
Task: Find id from orders where amount exceeds the average salary from employees for the same id.
SQL:

SELECT id FROM orders AS mgr
WHERE amount > (
    SELECT AVG(salary) FROM employees AS inv
    WHERE inv.id = mgr.id
);


Prompt:
Schema:
  branches (alias: whs)(amount, id, status, date)
  regions(date, amount, code, value)
Task: Retrieve value from branches that have at least one corresponding entry in regions sharing the same code.
SQL:

SELECT value FROM branches AS whs
WHERE EXISTS (
    SELECT 1 FROM regions AS empl
    WHERE empl.code = whs.code
);


Prompt:
Schema:
  regions (alias: rgn)(id, type, status, name)
  suppliers(status, salary, id, name)
Task: Find amount from regions where salary exceeds the average salary from suppliers for the same type.
SQL:

SELECT amount FROM regions AS rgn
WHERE salary > (
    SELECT MIN(salary) FROM suppliers AS shp
    WHERE shp.type = rgn.type
);


Prompt:
Schema:
  categories (alias: dept)(amount, name, type, level)
  orders(salary, date, code, type)
Task: Find code from categories where value exceeds the average salary from orders for the same status.
SQL:

SELECT code FROM categories AS dept
WHERE value > (
    SELECT COUNT(salary) FROM orders AS txn
    WHERE txn.status = dept.status
);


Prompt:
Schema:
  invoices (alias: whs)(level, value, name, id)
  orders(code, salary, amount, status)
Task: Find salary from invoices where a matching record exists in orders with the same status.
SQL:

SELECT salary FROM invoices AS whs
WHERE EXISTS (
    SELECT 1 FROM orders AS ord
    WHERE ord.status = whs.status
);


Prompt:
Schema:
  departments (alias: dept)(name, status, amount, code)
  customers(code, name, salary, status)
Task: Retrieve name from departments whose type is found in customers rows where status matches the outer record.
SQL:

SELECT name FROM departments AS dept
WHERE type IN (
    SELECT type FROM customers AS txn
    WHERE txn.status = dept.status
);


Prompt:
Schema:
  categories (alias: emp)(amount, type, id, code)
  transactions(name, status, value, amount)
Task: Retrieve amount from categories that have at least one corresponding entry in transactions sharing the same level.
SQL:

SELECT amount FROM categories AS emp
WHERE EXISTS (
    SELECT 1 FROM transactions AS whs
    WHERE whs.level = emp.level
);


Prompt:
Schema:
  invoices (alias: empl)(type, value, code, name)
  tasks(status, type, value, id)
Task: Retrieve value from invoices with salary above the SUM(salary) of tasks rows sharing the same status.
SQL:

SELECT value FROM invoices AS empl
WHERE salary > (
    SELECT SUM(salary) FROM tasks AS dept
    WHERE dept.status = empl.status
);


Prompt:
Schema:
  invoices (alias: acct)(level, type, value, code)
  shipments(level, amount, date, id)
Task: Find name from invoices where value exceeds the average amount from shipments for the same level.
SQL:

SELECT name FROM invoices AS acct
WHERE value > (
    SELECT AVG(amount) FROM shipments AS empl
    WHERE empl.level = acct.level
);


Prompt:
Schema:
  invoices (alias: ordr)(salary, name, amount, id)
  transactions(name, status, code, date)
Task: Find name from invoices where a matching record exists in transactions with the same level.
SQL:

SELECT name FROM invoices AS ordr
WHERE EXISTS (
    SELECT 1 FROM transactions AS prod
    WHERE prod.level = ordr.level
);


Prompt:
Schema:
  accounts (alias: acct)(salary, level, type, code)
  shipments(level, id, salary, type)
Task: Find value from accounts where type appears in shipments entries with matching level.
SQL:

SELECT value FROM accounts AS acct
WHERE type IN (
    SELECT type FROM shipments AS ordr
    WHERE ordr.level = acct.level
);


Prompt:
Schema:
  regions (alias: mgr)(date, salary, amount, level)
  branches(type, code, status, id)
Task: Retrieve name from regions with value above the AVG(salary) of branches rows sharing the same id.
SQL:

SELECT name FROM regions AS mgr
WHERE value > (
    SELECT AVG(salary) FROM branches AS srvc
    WHERE srvc.id = mgr.id
);


Prompt:
Schema:
  products (alias: ordr)(type, name, amount, value)
  employees(level, value, code, type)
Task: Find name from products where id appears in employees entries with matching type.
SQL:

SELECT name FROM products AS ordr
WHERE id IN (
    SELECT id FROM employees AS whs
    WHERE whs.type = ordr.type
);


Prompt:
Schema:
  branches (alias: budg)(type, level, code, value)
  customers(name, date, level, code)
Task: Find value from branches where id appears in customers entries with matching type.
SQL:

SELECT value FROM branches AS budg
WHERE id IN (
    SELECT id FROM customers AS ordr
    WHERE ordr.type = budg.type
);


Prompt:
Schema:
  warehouses (alias: mgr)(date, level, code, status)
  projects(id, value, salary, type)
Task: Find salary from warehouses where a matching record exists in projects with the same status.
SQL:

SELECT salary FROM warehouses AS mgr
WHERE EXISTS (
    SELECT 1 FROM projects AS sale
    WHERE sale.status = mgr.status
);


Prompt:
Schema:
  projects (alias: ordr)(amount, code, date, level)
  departments(amount, name, status, id)
Task: Find id from projects where a matching record exists in departments with the same code.
SQL:

SELECT id FROM projects AS ordr
WHERE EXISTS (
    SELECT 1 FROM departments AS schd
    WHERE schd.code = ordr.code
);


Prompt:
Schema:
  invoices (alias: lne)(code, id, status, amount)
  suppliers(amount, value, type, level)
Task: Select value from invoices where code exists in suppliers for the same status.
SQL:

SELECT value FROM invoices AS lne
WHERE code IN (
    SELECT code FROM suppliers AS txn
    WHERE txn.status = lne.status
);


Prompt:
Schema:
  orders (alias: mgr)(amount, salary, value, status)
  transactions(status, id, name, date)
Task: Find salary from orders where amount exceeds the average amount from transactions for the same id.
SQL:

SELECT salary FROM orders AS mgr
WHERE amount > (
    SELECT MAX(amount) FROM transactions AS ord
    WHERE ord.id = mgr.id
);


Prompt:
Schema:
  invoices (alias: emp)(code, status, value, date)
  products(salary, name, value, id)
Task: Find code from invoices where a matching record exists in products with the same id.
SQL:

SELECT code FROM invoices AS emp
WHERE EXISTS (
    SELECT 1 FROM products AS budg
    WHERE budg.id = emp.id
);


Prompt:
Schema:
  products (alias: prod)(id, type, code, status)
  departments(value, status, level, type)
Task: Retrieve code from products with value above the MIN(amount) of departments rows sharing the same status.
SQL:

SELECT code FROM products AS prod
WHERE value > (
    SELECT MIN(amount) FROM departments AS txn
    WHERE txn.status = prod.status
);


Prompt:
Schema:
  transactions (alias: empl)(value, code, level, status)
  tasks(name, level, status, value)
Task: Find amount from transactions where salary exceeds the average salary from tasks for the same status.
SQL:

SELECT amount FROM transactions AS empl
WHERE salary > (
    SELECT COUNT(salary) FROM tasks AS emp
    WHERE emp.status = empl.status
);


Prompt:
Schema:
  customers (alias: mgr)(id, code, amount, salary)
  branches(level, status, name, id)
Task: Find name from customers where salary exceeds the average salary from branches for the same type.
SQL:

SELECT name FROM customers AS mgr
WHERE salary > (
    SELECT COUNT(salary) FROM branches AS prod
    WHERE prod.type = mgr.type
);


Prompt:
Schema:
  products (alias: txn)(name, id, amount, value)
  projects(date, level, id, status)
Task: Find value from products where a matching record exists in projects with the same code.
SQL:

SELECT value FROM products AS txn
WHERE EXISTS (
    SELECT 1 FROM projects AS srvc
    WHERE srvc.code = txn.code
);


Prompt:
Schema:
  regions (alias: srvc)(salary, name, level, id)
  suppliers(value, id, name, code)
Task: Find value from regions where code appears in suppliers entries with matching code.
SQL:

SELECT value FROM regions AS srvc
WHERE code IN (
    SELECT code FROM suppliers AS dept
    WHERE dept.code = srvc.code
);


Prompt:
Schema:
  employees (alias: ordr)(amount, status, name, type)
  products(status, date, amount, name)
Task: Retrieve code from employees that have at least one corresponding entry in products sharing the same status.
SQL:

SELECT code FROM employees AS ordr
WHERE EXISTS (
    SELECT 1 FROM products AS txn
    WHERE txn.status = ordr.status
);


Prompt:
Schema:
  transactions (alias: inv)(value, amount, level, status)
  warehouses(code, type, id, status)
Task: Retrieve code from transactions that have at least one corresponding entry in warehouses sharing the same level.
SQL:

SELECT code FROM transactions AS inv
WHERE EXISTS (
    SELECT 1 FROM warehouses AS acct
    WHERE acct.level = inv.level
);


Prompt:
Schema:
  regions (alias: rgn)(date, level, salary, code)
  accounts(status, type, value, name)
Task: Select name from regions where status exists in accounts for the same level.
SQL:

SELECT name FROM regions AS rgn
WHERE status IN (
    SELECT status FROM accounts AS prod
    WHERE prod.level = rgn.level
);


Prompt:
Schema:
  customers (alias: empl)(salary, date, value, name)
  regions(amount, name, level, value)
Task: Find salary from customers where status appears in regions entries with matching type.
SQL:

SELECT salary FROM customers AS empl
WHERE status IN (
    SELECT status FROM regions AS srvc
    WHERE srvc.type = empl.type
);


Prompt:
Schema:
  branches (alias: budg)(salary, value, type, status)
  shipments(salary, amount, id, status)
Task: Retrieve amount from branches that have at least one corresponding entry in shipments sharing the same id.
SQL:

SELECT amount FROM branches AS budg
WHERE EXISTS (
    SELECT 1 FROM shipments AS whs
    WHERE whs.id = budg.id
);


Prompt:
Schema:
  branches (alias: schd)(name, status, amount, id)
  products(name, status, salary, level)
Task: Retrieve code from branches that have at least one corresponding entry in products sharing the same level.
SQL:

SELECT code FROM branches AS schd
WHERE EXISTS (
    SELECT 1 FROM products AS srvc
    WHERE srvc.level = schd.level
);


Prompt:
Schema:
  warehouses (alias: srvc)(code, name, value, date)
  branches(name, status, date, code)
Task: Find amount from warehouses where amount exceeds the average amount from branches for the same type.
SQL:

SELECT amount FROM warehouses AS srvc
WHERE amount > (
    SELECT AVG(amount) FROM branches AS rgn
    WHERE rgn.type = srvc.type
);


Prompt:
Schema:
  products (alias: txn)(level, date, type, code)
  tasks(name, level, status, type)
Task: Select amount from products where level exists in tasks for the same level.
SQL:

SELECT amount FROM products AS txn
WHERE level IN (
    SELECT level FROM tasks AS whs
    WHERE whs.level = txn.level
);


Prompt:
Schema:
  accounts (alias: empl)(level, amount, value, code)
  employees(level, code, status, type)
Task: Find code from accounts where a matching record exists in employees with the same code.
SQL:

SELECT code FROM accounts AS empl
WHERE EXISTS (
    SELECT 1 FROM employees AS dept
    WHERE dept.code = empl.code
);


Prompt:
Schema:
  orders (alias: sale)(type, level, salary, amount)
  shipments(value, level, status, date)
Task: Retrieve value from orders whose type is found in shipments rows where code matches the outer record.
SQL:

SELECT value FROM orders AS sale
WHERE type IN (
    SELECT type FROM shipments AS empl
    WHERE empl.code = sale.code
);


Prompt:
Schema:
  tasks (alias: whs)(value, name, id, status)
  employees(id, name, date, value)
Task: Find name from tasks where salary exceeds the average salary from employees for the same status.
SQL:

SELECT name FROM tasks AS whs
WHERE salary > (
    SELECT COUNT(salary) FROM employees AS mgr
    WHERE mgr.status = whs.status
);


Prompt:
Schema:
  transactions (alias: empl)(id, date, status, name)
  regions(code, id, amount, level)
Task: Retrieve amount from transactions whose id is found in regions rows where status matches the outer record.
SQL:

SELECT amount FROM transactions AS empl
WHERE id IN (
    SELECT id FROM regions AS ord
    WHERE ord.status = empl.status
);


Prompt:
Schema:
  products (alias: acct)(salary, level, date, status)
  warehouses(id, value, type, amount)
Task: Find salary from products where a matching record exists in warehouses with the same level.
SQL:

SELECT salary FROM products AS acct
WHERE EXISTS (
    SELECT 1 FROM warehouses AS ord
    WHERE ord.level = acct.level
);


Prompt:
Schema:
  products (alias: shp)(id, type, salary, date)
  invoices(type, code, date, id)
Task: Find name from products where a matching record exists in invoices with the same status.
SQL:

SELECT name FROM products AS shp
WHERE EXISTS (
    SELECT 1 FROM invoices AS lne
    WHERE lne.status = shp.status
);


Prompt:
Schema:
  tasks (alias: emp)(type, status, salary, id)
  branches(code, name, salary, amount)
Task: Find salary from tasks where a matching record exists in branches with the same type.
SQL:

SELECT salary FROM tasks AS emp
WHERE EXISTS (
    SELECT 1 FROM branches AS lne
    WHERE lne.type = emp.type
);


Prompt:
Schema:
  shipments (alias: ord)(type, name, status, date)
  tasks(level, date, value, salary)
Task: Retrieve amount from shipments whose level is found in tasks rows where type matches the outer record.
SQL:

SELECT amount FROM shipments AS ord
WHERE level IN (
    SELECT level FROM tasks AS ordr
    WHERE ordr.type = ord.type
);


Prompt:
Schema:
  transactions (alias: txn)(status, date, name, id)
  shipments(status, id, date, code)
Task: Select name from transactions where level exists in shipments for the same type.
SQL:

SELECT name FROM transactions AS txn
WHERE level IN (
    SELECT level FROM shipments AS srvc
    WHERE srvc.type = txn.type
);


Prompt:
Schema:
  suppliers (alias: ord)(status, value, salary, id)
  shipments(salary, status, level, amount)
Task: Retrieve name from suppliers that have at least one corresponding entry in shipments sharing the same status.
SQL:

SELECT name FROM suppliers AS ord
WHERE EXISTS (
    SELECT 1 FROM shipments AS lne
    WHERE lne.status = ord.status
);


Prompt:
Schema:
  transactions (alias: budg)(level, salary, type, id)
  orders(id, name, code, type)
Task: Find value from transactions where a matching record exists in orders with the same level.
SQL:

SELECT value FROM transactions AS budg
WHERE EXISTS (
    SELECT 1 FROM orders AS srvc
    WHERE srvc.level = budg.level
);


Prompt:
Schema:
  departments (alias: txn)(value, salary, type, amount)
  projects(code, name, status, date)
Task: Find code from departments where value exceeds the average salary from projects for the same id.
SQL:

SELECT code FROM departments AS txn
WHERE value > (
    SELECT COUNT(salary) FROM projects AS whs
    WHERE whs.id = txn.id
);


Prompt:
Schema:
  regions (alias: schd)(amount, type, status, code)
  warehouses(salary, date, id, level)
Task: Retrieve name from regions that have at least one corresponding entry in warehouses sharing the same level.
SQL:

SELECT name FROM regions AS schd
WHERE EXISTS (
    SELECT 1 FROM warehouses AS lne
    WHERE lne.level = schd.level
);


Prompt:
Schema:
  tasks (alias: empl)(id, level, salary, amount)
  warehouses(level, id, date, name)
Task: Retrieve name from tasks that have at least one corresponding entry in warehouses sharing the same level.
SQL:

SELECT name FROM tasks AS empl
WHERE EXISTS (
    SELECT 1 FROM warehouses AS txn
    WHERE txn.level = empl.level
);


Prompt:
Schema:
  customers (alias: schd)(salary, code, date, amount)
  transactions(type, amount, code, status)
Task: Find id from customers where salary exceeds the average salary from transactions for the same code.
SQL:

SELECT id FROM customers AS schd
WHERE salary > (
    SELECT MIN(salary) FROM transactions AS srvc
    WHERE srvc.code = schd.code
);


Prompt:
Schema:
  suppliers (alias: emp)(amount, value, date, name)
  accounts(amount, code, salary, level)
Task: Find salary from suppliers where type appears in accounts entries with matching code.
SQL:

SELECT salary FROM suppliers AS emp
WHERE type IN (
    SELECT type FROM accounts AS mgr
    WHERE mgr.code = emp.code
);


Prompt:
Schema:
  departments (alias: budg)(salary, date, type, name)
  products(status, code, id, level)
Task: Retrieve code from departments that have at least one corresponding entry in products sharing the same status.
SQL:

SELECT code FROM departments AS budg
WHERE EXISTS (
    SELECT 1 FROM products AS empl
    WHERE empl.status = budg.status
);


Prompt:
Schema:
  transactions (alias: rgn)(level, name, status, salary)
  invoices(date, type, value, status)
Task: Retrieve name from transactions that have at least one corresponding entry in invoices sharing the same level.
SQL:

SELECT name FROM transactions AS rgn
WHERE EXISTS (
    SELECT 1 FROM invoices AS cust
    WHERE cust.level = rgn.level
);


Prompt:
Schema:
  customers (alias: prod)(amount, name, id, type)
  branches(status, code, id, level)
Task: Retrieve salary from customers that have at least one corresponding entry in branches sharing the same level.
SQL:

SELECT salary FROM customers AS prod
WHERE EXISTS (
    SELECT 1 FROM branches AS budg
    WHERE budg.level = prod.level
);


Prompt:
Schema:
  invoices (alias: whs)(salary, level, code, amount)
  regions(type, level, amount, id)
Task: Find name from invoices where value exceeds the average value from regions for the same level.
SQL:

SELECT name FROM invoices AS whs
WHERE value > (
    SELECT AVG(value) FROM regions AS dept
    WHERE dept.level = whs.level
);


Prompt:
Schema:
  tasks (alias: empl)(date, salary, status, type)
  invoices(status, type, date, salary)
Task: Retrieve salary from tasks with value above the MIN(value) of invoices rows sharing the same id.
SQL:

SELECT salary FROM tasks AS empl
WHERE value > (
    SELECT MIN(value) FROM invoices AS prod
    WHERE prod.id = empl.id
);


Prompt:
Schema:
  employees (alias: budg)(amount, name, type, value)
  warehouses(id, amount, type, date)
Task: Find code from employees where a matching record exists in warehouses with the same id.
SQL:

SELECT code FROM employees AS budg
WHERE EXISTS (
    SELECT 1 FROM warehouses AS txn
    WHERE txn.id = budg.id
);


Prompt:
Schema:
  employees (alias: whs)(amount, level, salary, code)
  invoices(type, amount, level, salary)
Task: Retrieve id from employees with amount above the MIN(amount) of invoices rows sharing the same code.
SQL:

SELECT id FROM employees AS whs
WHERE amount > (
    SELECT MIN(amount) FROM invoices AS empl
    WHERE empl.code = whs.code
);


Prompt:
Schema:
  tasks (alias: ordr)(type, date, value, status)
  regions(id, value, code, status)
Task: Retrieve code from tasks with salary above the MAX(value) of regions rows sharing the same id.
SQL:

SELECT code FROM tasks AS ordr
WHERE salary > (
    SELECT MAX(value) FROM regions AS lne
    WHERE lne.id = ordr.id
);


Prompt:
Schema:
  projects (alias: emp)(code, value, amount, type)
  orders(salary, amount, date, type)
Task: Find salary from projects where value exceeds the average value from orders for the same status.
SQL:

SELECT salary FROM projects AS emp
WHERE value > (
    SELECT AVG(value) FROM orders AS rgn
    WHERE rgn.status = emp.status
);


Prompt:
Schema:
  customers (alias: txn)(value, id, date, name)
  categories(amount, id, salary, type)
Task: Retrieve salary from customers that have at least one corresponding entry in categories sharing the same id.
SQL:

SELECT salary FROM customers AS txn
WHERE EXISTS (
    SELECT 1 FROM categories AS rgn
    WHERE rgn.id = txn.id
);


Prompt:
Schema:
  accounts (alias: rgn)(code, salary, status, id)
  tasks(type, name, value, date)
Task: Select id from accounts where level exists in tasks for the same type.
SQL:

SELECT id FROM accounts AS rgn
WHERE level IN (
    SELECT level FROM tasks AS dept
    WHERE dept.type = rgn.type
);


Prompt:
Schema:
  accounts (alias: acct)(level, date, type, name)
  invoices(status, code, level, id)
Task: Retrieve id from accounts with salary above the MAX(salary) of invoices rows sharing the same code.
SQL:

SELECT id FROM accounts AS acct
WHERE salary > (
    SELECT MAX(salary) FROM invoices AS empl
    WHERE empl.code = acct.code
);


Prompt:
Schema:
  customers (alias: empl)(level, date, amount, code)
  categories(date, name, id, salary)
Task: Find id from customers where salary exceeds the average amount from categories for the same type.
SQL:

SELECT id FROM customers AS empl
WHERE salary > (
    SELECT COUNT(amount) FROM categories AS inv
    WHERE inv.type = empl.type
);


Prompt:
Schema:
  shipments (alias: lne)(code, type, level, salary)
  regions(value, salary, date, id)
Task: Retrieve amount from shipments with value above the COUNT(value) of regions rows sharing the same code.
SQL:

SELECT amount FROM shipments AS lne
WHERE value > (
    SELECT COUNT(value) FROM regions AS dept
    WHERE dept.code = lne.code
);


Prompt:
Schema:
  departments (alias: lne)(value, status, type, name)
  tasks(level, value, status, type)
Task: Select code from departments where level exists in tasks for the same level.
SQL:

SELECT code FROM departments AS lne
WHERE level IN (
    SELECT level FROM tasks AS budg
    WHERE budg.level = lne.level
);


Prompt:
Schema:
  orders (alias: prod)(name, value, type, status)
  accounts(level, code, status, amount)
Task: Retrieve code from orders that have at least one corresponding entry in accounts sharing the same level.
SQL:

SELECT code FROM orders AS prod
WHERE EXISTS (
    SELECT 1 FROM accounts AS emp
    WHERE emp.level = prod.level
);


Prompt:
Schema:
  orders (alias: shp)(amount, type, value, date)
  shipments(level, status, value, id)
Task: Retrieve value from orders with amount above the SUM(salary) of shipments rows sharing the same status.
SQL:

SELECT value FROM orders AS shp
WHERE amount > (
    SELECT SUM(salary) FROM shipments AS whs
    WHERE whs.status = shp.status
);


Prompt:
Schema:
  departments (alias: mgr)(value, name, level, id)
  transactions(status, amount, value, name)
Task: Retrieve name from departments whose status is found in transactions rows where status matches the outer record.
SQL:

SELECT name FROM departments AS mgr
WHERE status IN (
    SELECT status FROM transactions AS budg
    WHERE budg.status = mgr.status
);


Prompt:
Schema:
  categories (alias: emp)(id, amount, type, code)
  customers(date, type, amount, value)
Task: Retrieve code from categories that have at least one corresponding entry in customers sharing the same level.
SQL:

SELECT code FROM categories AS emp
WHERE EXISTS (
    SELECT 1 FROM customers AS prod
    WHERE prod.level = emp.level
);


Prompt:
Schema:
  projects (alias: ord)(type, value, salary, code)
  customers(name, type, status, salary)
Task: Find id from projects where value exceeds the average salary from customers for the same code.
SQL:

SELECT id FROM projects AS ord
WHERE value > (
    SELECT MAX(salary) FROM customers AS emp
    WHERE emp.code = ord.code
);


Prompt:
Schema:
  departments (alias: budg)(value, code, status, date)
  invoices(id, amount, salary, code)
Task: Retrieve value from departments whose id is found in invoices rows where code matches the outer record.
SQL:

SELECT value FROM departments AS budg
WHERE id IN (
    SELECT id FROM invoices AS inv
    WHERE inv.code = budg.code
);


Prompt:
Schema:
  transactions (alias: budg)(date, value, id, code)
  orders(name, code, salary, status)
Task: Find name from transactions where salary exceeds the average salary from orders for the same level.
SQL:

SELECT name FROM transactions AS budg
WHERE salary > (
    SELECT SUM(salary) FROM orders AS emp
    WHERE emp.level = budg.level
);


Prompt:
Schema:
  departments (alias: txn)(code, amount, date, level)
  projects(code, salary, level, value)
Task: Retrieve salary from departments with value above the SUM(amount) of projects rows sharing the same level.
SQL:

SELECT salary FROM departments AS txn
WHERE value > (
    SELECT SUM(amount) FROM projects AS lne
    WHERE lne.level = txn.level
);


Prompt:
Schema:
  transactions (alias: budg)(level, value, date, status)
  suppliers(date, code, level, id)
Task: Retrieve amount from transactions that have at least one corresponding entry in suppliers sharing the same id.
SQL:

SELECT amount FROM transactions AS budg
WHERE EXISTS (
    SELECT 1 FROM suppliers AS schd
    WHERE schd.id = budg.id
);


Prompt:
Schema:
  regions (alias: whs)(status, level, name, code)
  tasks(amount, date, salary, status)
Task: Retrieve value from regions whose type is found in tasks rows where type matches the outer record.
SQL:

SELECT value FROM regions AS whs
WHERE type IN (
    SELECT type FROM tasks AS budg
    WHERE budg.type = whs.type
);


Prompt:
Schema:
  tasks (alias: cust)(salary, status, type, date)
  categories(id, date, value, amount)
Task: Retrieve id from tasks that have at least one corresponding entry in categories sharing the same type.
SQL:

SELECT id FROM tasks AS cust
WHERE EXISTS (
    SELECT 1 FROM categories AS lne
    WHERE lne.type = cust.type
);


Prompt:
Schema:
  shipments (alias: empl)(value, type, date, code)
  customers(id, status, code, salary)
Task: Retrieve amount from shipments whose level is found in customers rows where level matches the outer record.
SQL:

SELECT amount FROM shipments AS empl
WHERE level IN (
    SELECT level FROM customers AS lne
    WHERE lne.level = empl.level
);


Prompt:
Schema:
  orders (alias: cust)(level, type, status, name)
  projects(id, date, value, name)
Task: Retrieve amount from orders with salary above the AVG(amount) of projects rows sharing the same type.
SQL:

SELECT amount FROM orders AS cust
WHERE salary > (
    SELECT AVG(amount) FROM projects AS budg
    WHERE budg.type = cust.type
);


Prompt:
Schema:
  orders (alias: prod)(status, date, value, name)
  customers(salary, date, code, name)
Task: Retrieve id from orders whose type is found in customers rows where code matches the outer record.
SQL:

SELECT id FROM orders AS prod
WHERE type IN (
    SELECT type FROM customers AS whs
    WHERE whs.code = prod.code
);


Prompt:
Schema:
  projects (alias: mgr)(code, salary, level, status)
  tasks(name, salary, date, amount)
Task: Retrieve salary from projects that have at least one corresponding entry in tasks sharing the same id.
SQL:

SELECT salary FROM projects AS mgr
WHERE EXISTS (
    SELECT 1 FROM tasks AS whs
    WHERE whs.id = mgr.id
);


Prompt:
Schema:
  orders (alias: emp)(level, date, name, type)
  suppliers(salary, level, code, type)
Task: Retrieve value from orders that have at least one corresponding entry in suppliers sharing the same type.
SQL:

SELECT value FROM orders AS emp
WHERE EXISTS (
    SELECT 1 FROM suppliers AS srvc
    WHERE srvc.type = emp.type
);


Prompt:
Schema:
  regions (alias: shp)(value, name, code, level)
  suppliers(status, salary, amount, code)
Task: Retrieve value from regions that have at least one corresponding entry in suppliers sharing the same code.
SQL:

SELECT value FROM regions AS shp
WHERE EXISTS (
    SELECT 1 FROM suppliers AS schd
    WHERE schd.code = shp.code
);


Prompt:
Schema:
  warehouses (alias: budg)(level, amount, value, code)
  projects(value, id, level, code)
Task: Retrieve salary from warehouses whose level is found in projects rows where status matches the outer record.
SQL:

SELECT salary FROM warehouses AS budg
WHERE level IN (
    SELECT level FROM projects AS rgn
    WHERE rgn.status = budg.status
);


Prompt:
Schema:
  invoices (alias: catg)(status, name, id, code)
  regions(amount, type, level, status)
Task: Retrieve amount from invoices that have at least one corresponding entry in regions sharing the same status.
SQL:

SELECT amount FROM invoices AS catg
WHERE EXISTS (
    SELECT 1 FROM regions AS cust
    WHERE cust.status = catg.status
);