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

SELECT code FROM transactions AS txn
WHERE amount > (
    SELECT COUNT(salary) FROM employees AS srvc
    WHERE srvc.id = txn.id
);


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

SELECT code FROM warehouses AS cust
WHERE EXISTS (
    SELECT 1 FROM suppliers AS lne
    WHERE lne.code = cust.code
);


Prompt:
Schema:
  transactions (alias: prod)(status, salary, id, level)
  orders(id, value, amount, code)
Task: Find amount from transactions where code appears in orders entries with matching code.
SQL:

SELECT amount FROM transactions AS prod
WHERE code IN (
    SELECT code FROM orders AS mgr
    WHERE mgr.code = prod.code
);


Prompt:
Schema:
  categories (alias: acct)(code, value, type, salary)
  suppliers(code, value, type, id)
Task: Retrieve value from categories with salary above the MAX(value) of suppliers rows sharing the same code.
SQL:

SELECT value FROM categories AS acct
WHERE salary > (
    SELECT MAX(value) FROM suppliers AS sale
    WHERE sale.code = acct.code
);


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

SELECT name FROM suppliers AS catg
WHERE EXISTS (
    SELECT 1 FROM branches AS schd
    WHERE schd.level = catg.level
);


Prompt:
Schema:
  employees (alias: schd)(id, salary, amount, name)
  branches(value, date, salary, amount)
Task: Find amount from employees where a matching record exists in branches with the same id.
SQL:

SELECT amount FROM employees AS schd
WHERE EXISTS (
    SELECT 1 FROM branches AS txn
    WHERE txn.id = schd.id
);


Prompt:
Schema:
  departments (alias: sale)(type, value, status, code)
  products(code, type, status, salary)
Task: Find salary from departments where value exceeds the average amount from products for the same status.
SQL:

SELECT salary FROM departments AS sale
WHERE value > (
    SELECT MAX(amount) FROM products AS rgn
    WHERE rgn.status = sale.status
);


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

SELECT id FROM invoices AS txn
WHERE status IN (
    SELECT status FROM accounts AS cust
    WHERE cust.level = txn.level
);


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

SELECT amount FROM categories AS acct
WHERE EXISTS (
    SELECT 1 FROM projects AS rgn
    WHERE rgn.code = acct.code
);


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

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


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

SELECT name FROM transactions AS sale
WHERE salary > (
    SELECT AVG(salary) FROM customers AS empl
    WHERE empl.status = sale.status
);


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

SELECT id FROM invoices AS inv
WHERE code IN (
    SELECT code FROM orders AS dept
    WHERE dept.id = inv.id
);


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

SELECT salary FROM tasks AS empl
WHERE level IN (
    SELECT level FROM projects AS schd
    WHERE schd.id = empl.id
);


Prompt:
Schema:
  orders (alias: lne)(date, status, name, amount)
  transactions(name, status, date, value)
Task: Find amount from orders where a matching record exists in transactions with the same level.
SQL:

SELECT amount FROM orders AS lne
WHERE EXISTS (
    SELECT 1 FROM transactions AS acct
    WHERE acct.level = lne.level
);


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

SELECT amount FROM transactions AS sale
WHERE EXISTS (
    SELECT 1 FROM orders AS lne
    WHERE lne.type = sale.type
);


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

SELECT value FROM regions AS schd
WHERE salary > (
    SELECT MAX(salary) FROM customers AS sale
    WHERE sale.status = schd.status
);


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

SELECT salary FROM tasks AS lne
WHERE id IN (
    SELECT id FROM categories AS dept
    WHERE dept.id = lne.id
);


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

SELECT value FROM regions AS schd
WHERE EXISTS (
    SELECT 1 FROM employees AS cust
    WHERE cust.status = schd.status
);


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

SELECT amount FROM products AS inv
WHERE EXISTS (
    SELECT 1 FROM orders AS whs
    WHERE whs.status = inv.status
);


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

SELECT code FROM branches AS txn
WHERE EXISTS (
    SELECT 1 FROM employees AS cust
    WHERE cust.status = txn.status
);


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

SELECT name FROM customers AS srvc
WHERE value > (
    SELECT COUNT(salary) FROM projects AS whs
    WHERE whs.id = srvc.id
);


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

SELECT amount FROM shipments AS srvc
WHERE id IN (
    SELECT id FROM categories AS txn
    WHERE txn.code = srvc.code
);


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

SELECT name FROM tasks AS ord
WHERE type IN (
    SELECT type FROM branches AS inv
    WHERE inv.level = ord.level
);


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

SELECT salary FROM products AS dept
WHERE amount > (
    SELECT COUNT(salary) FROM categories AS cust
    WHERE cust.code = dept.code
);


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

SELECT id FROM orders AS shp
WHERE level IN (
    SELECT level FROM shipments AS lne
    WHERE lne.level = shp.level
);


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

SELECT name FROM projects AS whs
WHERE value > (
    SELECT COUNT(amount) FROM employees AS ord
    WHERE ord.code = whs.code
);


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

SELECT salary FROM employees AS prod
WHERE salary > (
    SELECT MAX(amount) FROM suppliers AS whs
    WHERE whs.id = prod.id
);


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

SELECT salary FROM accounts AS ord
WHERE value > (
    SELECT COUNT(value) FROM invoices AS sale
    WHERE sale.type = ord.type
);


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

SELECT value FROM invoices AS txn
WHERE amount > (
    SELECT MIN(value) FROM employees AS prod
    WHERE prod.code = txn.code
);


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

SELECT amount FROM regions AS cust
WHERE type IN (
    SELECT type FROM invoices AS rgn
    WHERE rgn.code = cust.code
);


Prompt:
Schema:
  invoices (alias: emp)(date, amount, status, type)
  warehouses(value, amount, date, status)
Task: Find amount from invoices where a matching record exists in warehouses with the same status.
SQL:

SELECT amount FROM invoices AS emp
WHERE EXISTS (
    SELECT 1 FROM warehouses AS ordr
    WHERE ordr.status = emp.status
);


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

SELECT salary FROM categories AS empl
WHERE id IN (
    SELECT id FROM invoices AS lne
    WHERE lne.code = empl.code
);


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

SELECT name FROM accounts AS dept
WHERE code IN (
    SELECT code FROM customers AS empl
    WHERE empl.level = dept.level
);


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

SELECT amount FROM products AS lne
WHERE salary > (
    SELECT COUNT(amount) FROM regions AS prod
    WHERE prod.status = lne.status
);


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

SELECT amount FROM employees AS lne
WHERE id IN (
    SELECT id FROM orders AS whs
    WHERE whs.code = lne.code
);


Prompt:
Schema:
  regions (alias: inv)(value, name, amount, type)
  transactions(amount, type, code, name)
Task: Find salary from regions where a matching record exists in transactions with the same type.
SQL:

SELECT salary FROM regions AS inv
WHERE EXISTS (
    SELECT 1 FROM transactions AS prod
    WHERE prod.type = inv.type
);


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

SELECT name FROM suppliers AS emp
WHERE EXISTS (
    SELECT 1 FROM transactions AS budg
    WHERE budg.level = emp.level
);


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

SELECT salary FROM regions AS ordr
WHERE status IN (
    SELECT status FROM accounts AS whs
    WHERE whs.id = ordr.id
);


Prompt:
Schema:
  departments (alias: prod)(date, id, amount, value)
  transactions(date, level, value, id)
Task: Find name from departments where amount exceeds the average salary from transactions for the same type.
SQL:

SELECT name FROM departments AS prod
WHERE amount > (
    SELECT COUNT(salary) FROM transactions AS shp
    WHERE shp.type = prod.type
);


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

SELECT code FROM transactions AS srvc
WHERE status IN (
    SELECT status FROM tasks AS prod
    WHERE prod.id = srvc.id
);


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

SELECT code FROM suppliers AS lne
WHERE type IN (
    SELECT type FROM accounts AS ordr
    WHERE ordr.status = lne.status
);


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

SELECT code FROM accounts AS empl
WHERE value > (
    SELECT AVG(salary) FROM invoices AS mgr
    WHERE mgr.type = empl.type
);


Prompt:
Schema:
  categories (alias: shp)(name, level, type, value)
  suppliers(status, name, code, type)
Task: Select salary from categories where status exists in suppliers for the same status.
SQL:

SELECT salary FROM categories AS shp
WHERE status IN (
    SELECT status FROM suppliers AS ord
    WHERE ord.status = shp.status
);


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

SELECT amount FROM employees AS rgn
WHERE EXISTS (
    SELECT 1 FROM products AS empl
    WHERE empl.status = rgn.status
);


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

SELECT code FROM accounts AS prod
WHERE value > (
    SELECT MAX(amount) FROM branches AS empl
    WHERE empl.id = prod.id
);


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

SELECT salary FROM categories AS budg
WHERE status IN (
    SELECT status FROM transactions AS whs
    WHERE whs.id = budg.id
);


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

SELECT id FROM warehouses AS sale
WHERE salary > (
    SELECT MIN(salary) FROM products AS srvc
    WHERE srvc.id = sale.id
);


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

SELECT code FROM invoices AS ord
WHERE code IN (
    SELECT code FROM orders AS whs
    WHERE whs.type = ord.type
);


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

SELECT salary FROM projects AS catg
WHERE EXISTS (
    SELECT 1 FROM warehouses AS ord
    WHERE ord.status = catg.status
);


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

SELECT salary FROM departments AS srvc
WHERE value > (
    SELECT MAX(value) FROM customers AS catg
    WHERE catg.level = srvc.level
);


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

SELECT name FROM customers AS whs
WHERE EXISTS (
    SELECT 1 FROM orders AS cust
    WHERE cust.status = whs.status
);


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

SELECT amount FROM branches AS budg
WHERE status IN (
    SELECT status FROM employees AS inv
    WHERE inv.code = budg.code
);


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

SELECT id FROM shipments AS cust
WHERE type IN (
    SELECT type FROM tasks AS schd
    WHERE schd.type = cust.type
);


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

SELECT name FROM suppliers AS budg
WHERE EXISTS (
    SELECT 1 FROM products AS cust
    WHERE cust.type = budg.type
);


Prompt:
Schema:
  products (alias: lne)(code, date, amount, type)
  customers(date, id, salary, type)
Task: Find code from products where a matching record exists in customers with the same code.
SQL:

SELECT code FROM products AS lne
WHERE EXISTS (
    SELECT 1 FROM customers AS inv
    WHERE inv.code = lne.code
);


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

SELECT name FROM accounts AS dept
WHERE status IN (
    SELECT status FROM projects AS empl
    WHERE empl.id = dept.id
);


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

SELECT value FROM projects AS catg
WHERE EXISTS (
    SELECT 1 FROM invoices AS budg
    WHERE budg.status = catg.status
);


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

SELECT value FROM orders AS sale
WHERE EXISTS (
    SELECT 1 FROM transactions AS budg
    WHERE budg.type = sale.type
);


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

SELECT amount FROM transactions AS lne
WHERE EXISTS (
    SELECT 1 FROM regions AS ordr
    WHERE ordr.type = lne.type
);


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

SELECT value FROM orders AS inv
WHERE EXISTS (
    SELECT 1 FROM products AS mgr
    WHERE mgr.id = inv.id
);


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

SELECT amount FROM orders AS mgr
WHERE value > (
    SELECT SUM(amount) FROM branches AS empl
    WHERE empl.id = mgr.id
);


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

SELECT salary FROM categories AS rgn
WHERE type IN (
    SELECT type FROM tasks AS dept
    WHERE dept.status = rgn.status
);


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

SELECT value FROM transactions AS shp
WHERE status IN (
    SELECT status FROM branches AS rgn
    WHERE rgn.type = shp.type
);


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

SELECT id FROM suppliers AS dept
WHERE code IN (
    SELECT code FROM customers AS rgn
    WHERE rgn.code = dept.code
);


Prompt:
Schema:
  tasks (alias: srvc)(date, type, level, value)
  departments(name, amount, id, value)
Task: Retrieve code from tasks with value above the COUNT(amount) of departments rows sharing the same level.
SQL:

SELECT code FROM tasks AS srvc
WHERE value > (
    SELECT COUNT(amount) FROM departments AS inv
    WHERE inv.level = srvc.level
);


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

SELECT code FROM warehouses AS shp
WHERE value > (
    SELECT MIN(salary) FROM employees AS ord
    WHERE ord.type = shp.type
);


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

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


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

SELECT id FROM suppliers AS srvc
WHERE EXISTS (
    SELECT 1 FROM regions AS empl
    WHERE empl.status = srvc.status
);


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

SELECT code FROM employees AS cust
WHERE value > (
    SELECT AVG(amount) FROM transactions AS sale
    WHERE sale.code = cust.code
);


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

SELECT value FROM employees AS srvc
WHERE salary > (
    SELECT SUM(amount) FROM orders AS acct
    WHERE acct.id = srvc.id
);


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

SELECT salary FROM orders AS ordr
WHERE code IN (
    SELECT code FROM shipments AS emp
    WHERE emp.code = ordr.code
);


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

SELECT salary FROM categories AS shp
WHERE EXISTS (
    SELECT 1 FROM invoices AS dept
    WHERE dept.id = shp.id
);


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

SELECT id FROM projects AS emp
WHERE salary > (
    SELECT SUM(value) FROM categories AS whs
    WHERE whs.id = emp.id
);


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

SELECT id FROM products AS dept
WHERE salary > (
    SELECT MAX(value) FROM shipments AS mgr
    WHERE mgr.status = dept.status
);


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

SELECT salary FROM tasks AS mgr
WHERE value > (
    SELECT MAX(value) FROM shipments AS inv
    WHERE inv.code = mgr.code
);


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

SELECT salary FROM departments AS emp
WHERE EXISTS (
    SELECT 1 FROM orders AS catg
    WHERE catg.id = emp.id
);


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

SELECT name FROM departments AS shp
WHERE EXISTS (
    SELECT 1 FROM transactions AS catg
    WHERE catg.level = shp.level
);


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

SELECT salary FROM departments AS emp
WHERE EXISTS (
    SELECT 1 FROM warehouses AS budg
    WHERE budg.type = emp.type
);


Prompt:
Schema:
  orders (alias: srvc)(name, level, amount, value)
  products(type, name, code, salary)
Task: Retrieve id from orders with amount above the COUNT(amount) of products rows sharing the same type.
SQL:

SELECT id FROM orders AS srvc
WHERE amount > (
    SELECT COUNT(amount) FROM products AS empl
    WHERE empl.type = srvc.type
);


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

SELECT name FROM products AS inv
WHERE EXISTS (
    SELECT 1 FROM invoices AS srvc
    WHERE srvc.type = inv.type
);


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

SELECT code FROM projects AS dept
WHERE type IN (
    SELECT type FROM transactions AS prod
    WHERE prod.level = dept.level
);


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

SELECT name FROM shipments AS empl
WHERE EXISTS (
    SELECT 1 FROM invoices AS catg
    WHERE catg.level = empl.level
);


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

SELECT code FROM invoices AS budg
WHERE EXISTS (
    SELECT 1 FROM accounts AS rgn
    WHERE rgn.id = budg.id
);


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

SELECT id FROM projects AS srvc
WHERE status IN (
    SELECT status FROM orders AS emp
    WHERE emp.id = srvc.id
);


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

SELECT amount FROM warehouses AS empl
WHERE EXISTS (
    SELECT 1 FROM tasks AS inv
    WHERE inv.type = empl.type
);


Prompt:
Schema:
  regions (alias: catg)(salary, code, type, value)
  tasks(code, name, status, date)
Task: Find salary from regions where salary exceeds the average salary from tasks for the same status.
SQL:

SELECT salary FROM regions AS catg
WHERE salary > (
    SELECT MAX(salary) FROM tasks AS ordr
    WHERE ordr.status = catg.status
);


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

SELECT code FROM departments AS lne
WHERE level IN (
    SELECT level FROM transactions AS ord
    WHERE ord.type = lne.type
);


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

SELECT code FROM warehouses AS schd
WHERE code IN (
    SELECT code FROM transactions AS mgr
    WHERE mgr.status = schd.status
);


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

SELECT salary FROM suppliers AS rgn
WHERE EXISTS (
    SELECT 1 FROM shipments AS catg
    WHERE catg.type = rgn.type
);


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

SELECT amount FROM branches AS rgn
WHERE amount > (
    SELECT COUNT(salary) FROM orders AS catg
    WHERE catg.type = rgn.type
);


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

SELECT id FROM suppliers AS budg
WHERE code IN (
    SELECT code FROM invoices AS ordr
    WHERE ordr.level = budg.level
);


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

SELECT salary FROM invoices AS srvc
WHERE level IN (
    SELECT level FROM products AS rgn
    WHERE rgn.level = srvc.level
);


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

SELECT value FROM invoices AS rgn
WHERE EXISTS (
    SELECT 1 FROM suppliers AS catg
    WHERE catg.type = rgn.type
);


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

SELECT salary FROM products AS empl
WHERE value > (
    SELECT COUNT(salary) FROM branches AS budg
    WHERE budg.level = empl.level
);


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

SELECT value FROM branches AS catg
WHERE EXISTS (
    SELECT 1 FROM customers AS inv
    WHERE inv.type = catg.type
);


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

SELECT value FROM departments AS empl
WHERE EXISTS (
    SELECT 1 FROM accounts AS ordr
    WHERE ordr.code = empl.code
);


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

SELECT value FROM transactions AS mgr
WHERE EXISTS (
    SELECT 1 FROM employees AS shp
    WHERE shp.id = mgr.id
);


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

SELECT value FROM tasks AS srvc
WHERE level IN (
    SELECT level FROM transactions AS whs
    WHERE whs.code = srvc.code
);


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

SELECT name FROM shipments AS empl
WHERE EXISTS (
    SELECT 1 FROM products AS schd
    WHERE schd.level = empl.level
);


Prompt:
Schema:
  transactions (alias: srvc)(level, amount, value, salary)
  departments(amount, level, salary, id)
Task: Find value from transactions where amount exceeds the average amount from departments for the same code.
SQL:

SELECT value FROM transactions AS srvc
WHERE amount > (
    SELECT AVG(amount) FROM departments AS inv
    WHERE inv.code = srvc.code
);


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

SELECT name FROM customers AS empl
WHERE EXISTS (
    SELECT 1 FROM projects AS acct
    WHERE acct.code = empl.code
);


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

SELECT amount FROM products AS rgn
WHERE EXISTS (
    SELECT 1 FROM regions AS whs
    WHERE whs.status = rgn.status
);


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

SELECT value FROM employees AS budg
WHERE EXISTS (
    SELECT 1 FROM suppliers AS txn
    WHERE txn.level = budg.level
);


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

SELECT salary FROM warehouses AS srvc
WHERE id IN (
    SELECT id FROM invoices AS budg
    WHERE budg.level = srvc.level
);


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

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


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

SELECT code FROM tasks AS prod
WHERE code IN (
    SELECT code FROM orders AS sale
    WHERE sale.status = prod.status
);


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

SELECT code FROM products AS srvc
WHERE EXISTS (
    SELECT 1 FROM departments AS mgr
    WHERE mgr.code = srvc.code
);


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

SELECT code FROM suppliers AS sale
WHERE code IN (
    SELECT code FROM accounts AS catg
    WHERE catg.id = sale.id
);


Prompt:
Schema:
  warehouses (alias: lne)(value, amount, code, type)
  projects(status, date, code, name)
Task: Find amount from warehouses where type appears in projects entries with matching level.
SQL:

SELECT amount FROM warehouses AS lne
WHERE type IN (
    SELECT type FROM projects AS empl
    WHERE empl.level = lne.level
);


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

SELECT salary FROM customers AS prod
WHERE EXISTS (
    SELECT 1 FROM employees AS sale
    WHERE sale.status = prod.status
);


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

SELECT salary FROM transactions AS sale
WHERE salary > (
    SELECT SUM(value) FROM branches AS ord
    WHERE ord.level = sale.level
);


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

SELECT value FROM warehouses AS shp
WHERE type IN (
    SELECT type FROM products AS ordr
    WHERE ordr.code = shp.code
);


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

SELECT code FROM regions AS empl
WHERE EXISTS (
    SELECT 1 FROM shipments AS catg
    WHERE catg.level = empl.level
);


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

SELECT code FROM transactions AS schd
WHERE EXISTS (
    SELECT 1 FROM branches AS txn
    WHERE txn.level = schd.level
);


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

SELECT salary FROM accounts AS txn
WHERE amount > (
    SELECT MIN(salary) FROM suppliers AS dept
    WHERE dept.id = txn.id
);


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

SELECT amount FROM invoices AS prod
WHERE id IN (
    SELECT id FROM products AS ord
    WHERE ord.status = prod.status
);


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

SELECT amount FROM regions AS rgn
WHERE salary > (
    SELECT AVG(value) FROM invoices AS dept
    WHERE dept.id = rgn.id
);


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

SELECT amount FROM regions AS txn
WHERE amount > (
    SELECT AVG(salary) FROM categories AS dept
    WHERE dept.id = txn.id
);


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

SELECT value FROM regions AS schd
WHERE salary > (
    SELECT MIN(value) FROM orders AS acct
    WHERE acct.type = schd.type
);


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

SELECT code FROM branches AS budg
WHERE type IN (
    SELECT type FROM orders AS dept
    WHERE dept.level = budg.level
);


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

SELECT value FROM products AS prod
WHERE status IN (
    SELECT status FROM categories AS mgr
    WHERE mgr.level = prod.level
);


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

SELECT name FROM branches AS mgr
WHERE salary > (
    SELECT SUM(amount) FROM regions AS cust
    WHERE cust.level = mgr.level
);


Prompt:
Schema:
  regions (alias: whs)(amount, id, salary, code)
  projects(level, code, status, date)
Task: Select name from regions where id exists in projects for the same code.
SQL:

SELECT name FROM regions AS whs
WHERE id IN (
    SELECT id FROM projects AS empl
    WHERE empl.code = whs.code
);


Prompt:
Schema:
  categories (alias: rgn)(salary, code, type, level)
  tasks(code, value, salary, type)
Task: Retrieve amount from categories with salary above the COUNT(salary) of tasks rows sharing the same status.
SQL:

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


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

SELECT salary FROM categories AS shp
WHERE EXISTS (
    SELECT 1 FROM projects AS rgn
    WHERE rgn.code = shp.code
);


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

SELECT salary FROM accounts AS empl
WHERE amount > (
    SELECT AVG(salary) FROM transactions AS catg
    WHERE catg.code = empl.code
);


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

SELECT code FROM projects AS sale
WHERE EXISTS (
    SELECT 1 FROM warehouses AS cust
    WHERE cust.id = sale.id
);


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

SELECT name FROM accounts AS whs
WHERE EXISTS (
    SELECT 1 FROM customers AS mgr
    WHERE mgr.code = whs.code
);


Prompt:
Schema:
  products (alias: ord)(date, code, status, level)
  suppliers(id, status, salary, code)
Task: Select value from products where status exists in suppliers for the same code.
SQL:

SELECT value FROM products AS ord
WHERE status IN (
    SELECT status FROM suppliers AS cust
    WHERE cust.code = ord.code
);


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

SELECT amount FROM invoices AS whs
WHERE amount > (
    SELECT COUNT(salary) FROM categories AS schd
    WHERE schd.code = whs.code
);


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

SELECT amount FROM categories AS mgr
WHERE salary > (
    SELECT COUNT(salary) FROM tasks AS srvc
    WHERE srvc.status = mgr.status
);


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

SELECT id FROM orders AS schd
WHERE level IN (
    SELECT level FROM accounts AS cust
    WHERE cust.status = schd.status
);


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

SELECT id FROM transactions AS prod
WHERE EXISTS (
    SELECT 1 FROM orders AS acct
    WHERE acct.level = prod.level
);


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

SELECT name FROM employees AS ord
WHERE EXISTS (
    SELECT 1 FROM customers AS mgr
    WHERE mgr.type = ord.type
);


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

SELECT id FROM customers AS acct
WHERE type IN (
    SELECT type FROM products AS dept
    WHERE dept.status = acct.status
);


Prompt:
Schema:
  categories (alias: schd)(status, id, type, code)
  suppliers(status, level, code, name)
Task: Select code from categories where status exists in suppliers for the same type.
SQL:

SELECT code FROM categories AS schd
WHERE status IN (
    SELECT status FROM suppliers AS emp
    WHERE emp.type = schd.type
);


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

SELECT name FROM departments AS rgn
WHERE id IN (
    SELECT id FROM branches AS cust
    WHERE cust.status = rgn.status
);


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

SELECT id FROM shipments AS ord
WHERE amount > (
    SELECT SUM(salary) FROM products AS acct
    WHERE acct.type = ord.type
);


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

SELECT salary FROM regions AS ordr
WHERE code IN (
    SELECT code FROM departments AS acct
    WHERE acct.status = ordr.status
);


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

SELECT id FROM projects AS acct
WHERE EXISTS (
    SELECT 1 FROM branches AS schd
    WHERE schd.level = acct.level
);


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

SELECT name FROM departments AS ord
WHERE id IN (
    SELECT id FROM employees AS shp
    WHERE shp.code = ord.code
);


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

SELECT id FROM employees AS txn
WHERE value > (
    SELECT COUNT(salary) FROM invoices AS catg
    WHERE catg.type = txn.type
);


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

SELECT name FROM regions AS catg
WHERE id IN (
    SELECT id FROM transactions AS dept
    WHERE dept.level = catg.level
);


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

SELECT amount FROM accounts AS empl
WHERE salary > (
    SELECT SUM(value) FROM products AS shp
    WHERE shp.code = empl.code
);


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

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


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

SELECT id FROM transactions AS schd
WHERE EXISTS (
    SELECT 1 FROM categories AS acct
    WHERE acct.code = schd.code
);


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

SELECT code FROM products AS schd
WHERE amount > (
    SELECT SUM(salary) FROM categories AS ordr
    WHERE ordr.code = schd.code
);


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

SELECT id FROM projects AS catg
WHERE EXISTS (
    SELECT 1 FROM employees AS cust
    WHERE cust.status = catg.status
);


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

SELECT salary FROM customers AS txn
WHERE code IN (
    SELECT code FROM accounts AS acct
    WHERE acct.type = txn.type
);


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

SELECT salary FROM regions AS prod
WHERE EXISTS (
    SELECT 1 FROM customers AS lne
    WHERE lne.type = prod.type
);


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

SELECT salary FROM branches AS catg
WHERE id IN (
    SELECT id FROM products AS emp
    WHERE emp.code = catg.code
);


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

SELECT value FROM transactions AS shp
WHERE amount > (
    SELECT SUM(salary) FROM branches AS dept
    WHERE dept.level = shp.level
);


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

SELECT value FROM suppliers AS dept
WHERE status IN (
    SELECT status FROM orders AS prod
    WHERE prod.code = dept.code
);


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

SELECT id FROM categories AS rgn
WHERE id IN (
    SELECT id FROM employees AS cust
    WHERE cust.type = rgn.type
);


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

SELECT amount FROM employees AS empl
WHERE EXISTS (
    SELECT 1 FROM shipments AS prod
    WHERE prod.id = empl.id
);


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

SELECT amount FROM employees AS dept
WHERE value > (
    SELECT MIN(salary) FROM categories AS txn
    WHERE txn.type = dept.type
);


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

SELECT amount FROM employees AS rgn
WHERE EXISTS (
    SELECT 1 FROM branches AS lne
    WHERE lne.id = rgn.id
);


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

SELECT id FROM products AS acct
WHERE id IN (
    SELECT id FROM shipments AS dept
    WHERE dept.id = acct.id
);


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

SELECT amount FROM transactions AS emp
WHERE code IN (
    SELECT code FROM shipments AS srvc
    WHERE srvc.level = emp.level
);


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

SELECT id FROM products AS inv
WHERE value > (
    SELECT COUNT(value) FROM regions AS ord
    WHERE ord.id = inv.id
);


Prompt:
Schema:
  transactions (alias: inv)(date, salary, level, id)
  branches(code, salary, date, id)
Task: Retrieve id from transactions with salary above the COUNT(value) of branches rows sharing the same type.
SQL:

SELECT id FROM transactions AS inv
WHERE salary > (
    SELECT COUNT(value) FROM branches AS acct
    WHERE acct.type = inv.type
);


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

SELECT id FROM transactions AS budg
WHERE EXISTS (
    SELECT 1 FROM tasks AS ordr
    WHERE ordr.code = budg.code
);


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

SELECT name FROM products AS whs
WHERE EXISTS (
    SELECT 1 FROM orders AS lne
    WHERE lne.id = whs.id
);


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

SELECT amount FROM suppliers AS schd
WHERE EXISTS (
    SELECT 1 FROM invoices AS rgn
    WHERE rgn.type = schd.type
);


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

SELECT salary FROM accounts AS acct
WHERE level IN (
    SELECT level FROM products AS inv
    WHERE inv.code = acct.code
);


Prompt:
Schema:
  tasks (alias: lne)(name, salary, id, type)
  suppliers(id, type, level, amount)
Task: Find salary from tasks where type appears in suppliers entries with matching type.
SQL:

SELECT salary FROM tasks AS lne
WHERE type IN (
    SELECT type FROM suppliers AS catg
    WHERE catg.type = lne.type
);


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

SELECT code FROM transactions AS shp
WHERE EXISTS (
    SELECT 1 FROM shipments AS inv
    WHERE inv.id = shp.id
);


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

SELECT code FROM warehouses AS rgn
WHERE salary > (
    SELECT SUM(salary) FROM transactions AS schd
    WHERE schd.code = rgn.code
);


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

SELECT name FROM shipments AS empl
WHERE salary > (
    SELECT MIN(value) FROM departments AS lne
    WHERE lne.status = empl.status
);


Prompt:
Schema:
  departments (alias: budg)(amount, salary, id, code)
  employees(level, name, value, id)
Task: Retrieve name from departments with salary above the SUM(salary) of employees rows sharing the same code.
SQL:

SELECT name FROM departments AS budg
WHERE salary > (
    SELECT SUM(salary) FROM employees AS schd
    WHERE schd.code = budg.code
);


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

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


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

SELECT code FROM tasks AS lne
WHERE EXISTS (
    SELECT 1 FROM suppliers AS cust
    WHERE cust.status = lne.status
);


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

SELECT value FROM departments AS emp
WHERE EXISTS (
    SELECT 1 FROM shipments AS ordr
    WHERE ordr.status = emp.status
);


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

SELECT name FROM departments AS lne
WHERE EXISTS (
    SELECT 1 FROM employees AS ordr
    WHERE ordr.code = lne.code
);


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

SELECT value FROM accounts AS catg
WHERE amount > (
    SELECT AVG(salary) FROM regions AS srvc
    WHERE srvc.level = catg.level
);


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

SELECT value FROM invoices AS emp
WHERE level IN (
    SELECT level FROM employees AS ordr
    WHERE ordr.level = emp.level
);


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

SELECT salary FROM employees AS ordr
WHERE amount > (
    SELECT SUM(amount) FROM suppliers AS dept
    WHERE dept.type = ordr.type
);


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

SELECT name FROM transactions AS ord
WHERE EXISTS (
    SELECT 1 FROM categories AS dept
    WHERE dept.status = ord.status
);


Prompt:
Schema:
  customers (alias: catg)(code, id, amount, type)
  products(date, salary, type, code)
Task: Find code from customers where a matching record exists in products with the same id.
SQL:

SELECT code FROM customers AS catg
WHERE EXISTS (
    SELECT 1 FROM products AS whs
    WHERE whs.id = catg.id
);


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

SELECT id FROM branches AS lne
WHERE EXISTS (
    SELECT 1 FROM employees AS acct
    WHERE acct.status = lne.status
);


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

SELECT salary FROM customers AS emp
WHERE salary > (
    SELECT COUNT(salary) FROM tasks AS srvc
    WHERE srvc.status = emp.status
);


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

SELECT amount FROM branches AS rgn
WHERE salary > (
    SELECT MAX(amount) FROM projects AS shp
    WHERE shp.status = rgn.status
);


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

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


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

SELECT id FROM products AS emp
WHERE EXISTS (
    SELECT 1 FROM transactions AS srvc
    WHERE srvc.type = emp.type
);


Prompt:
Schema:
  regions (alias: dept)(salary, amount, date, level)
  transactions(salary, id, level, value)
Task: Select name from regions where code exists in transactions for the same code.
SQL:

SELECT name FROM regions AS dept
WHERE code IN (
    SELECT code FROM transactions AS srvc
    WHERE srvc.code = dept.code
);


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

SELECT id FROM projects AS rgn
WHERE id IN (
    SELECT id FROM orders AS shp
    WHERE shp.status = rgn.status
);


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

SELECT id FROM tasks AS catg
WHERE id IN (
    SELECT id FROM employees AS inv
    WHERE inv.id = catg.id
);


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

SELECT code FROM suppliers AS srvc
WHERE EXISTS (
    SELECT 1 FROM shipments AS ord
    WHERE ord.id = srvc.id
);


Prompt:
Schema:
  projects (alias: inv)(amount, status, type, value)
  invoices(code, status, value, type)
Task: Find amount from projects where status appears in invoices entries with matching status.
SQL:

SELECT amount FROM projects AS inv
WHERE status IN (
    SELECT status FROM invoices AS acct
    WHERE acct.status = inv.status
);


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

SELECT value FROM shipments AS emp
WHERE value > (
    SELECT SUM(salary) FROM branches AS prod
    WHERE prod.status = emp.status
);


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

SELECT code FROM orders AS mgr
WHERE amount > (
    SELECT SUM(salary) FROM invoices AS srvc
    WHERE srvc.status = mgr.status
);


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

SELECT code FROM customers AS ord
WHERE EXISTS (
    SELECT 1 FROM warehouses AS prod
    WHERE prod.level = ord.level
);


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

SELECT id FROM regions AS emp
WHERE level IN (
    SELECT level FROM projects AS srvc
    WHERE srvc.id = emp.id
);


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

SELECT name FROM warehouses AS shp
WHERE type IN (
    SELECT type FROM transactions AS prod
    WHERE prod.level = shp.level
);


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

SELECT salary FROM suppliers AS shp
WHERE EXISTS (
    SELECT 1 FROM projects AS srvc
    WHERE srvc.status = shp.status
);


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

SELECT id FROM regions AS acct
WHERE value > (
    SELECT MIN(value) FROM shipments AS budg
    WHERE budg.level = acct.level
);


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

SELECT name FROM customers AS lne
WHERE EXISTS (
    SELECT 1 FROM categories AS sale
    WHERE sale.status = lne.status
);


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

SELECT code FROM projects AS ord
WHERE EXISTS (
    SELECT 1 FROM customers AS catg
    WHERE catg.type = ord.type
);


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

SELECT code FROM transactions AS sale
WHERE EXISTS (
    SELECT 1 FROM products AS budg
    WHERE budg.code = sale.code
);


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

SELECT code FROM tasks AS budg
WHERE EXISTS (
    SELECT 1 FROM products AS lne
    WHERE lne.id = budg.id
);


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

SELECT salary FROM departments AS mgr
WHERE id IN (
    SELECT id FROM products AS dept
    WHERE dept.code = mgr.code
);


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

SELECT amount FROM regions AS mgr
WHERE EXISTS (
    SELECT 1 FROM orders AS lne
    WHERE lne.type = mgr.type
);


Prompt:
Schema:
  customers (alias: mgr)(name, value, date, status)
  branches(value, name, type, code)
Task: Find name from customers where a matching record exists in branches with the same code.
SQL:

SELECT name FROM customers AS mgr
WHERE EXISTS (
    SELECT 1 FROM branches AS ordr
    WHERE ordr.code = mgr.code
);


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

SELECT name FROM customers AS inv
WHERE salary > (
    SELECT COUNT(salary) FROM orders AS cust
    WHERE cust.status = inv.status
);


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

SELECT amount FROM transactions AS catg
WHERE salary > (
    SELECT SUM(value) FROM tasks AS acct
    WHERE acct.level = catg.level
);


Prompt:
Schema:
  invoices (alias: sale)(type, status, level, amount)
  accounts(name, type, status, level)
Task: Find id from invoices where a matching record exists in accounts with the same status.
SQL:

SELECT id FROM invoices AS sale
WHERE EXISTS (
    SELECT 1 FROM accounts AS budg
    WHERE budg.status = sale.status
);


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

SELECT salary FROM employees AS whs
WHERE value > (
    SELECT MAX(salary) FROM departments AS lne
    WHERE lne.code = whs.code
);


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

SELECT id FROM branches AS empl
WHERE EXISTS (
    SELECT 1 FROM shipments AS cust
    WHERE cust.type = empl.type
);


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

SELECT code FROM regions AS lne
WHERE EXISTS (
    SELECT 1 FROM shipments AS txn
    WHERE txn.status = lne.status
);


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

SELECT salary FROM branches AS acct
WHERE status IN (
    SELECT status FROM suppliers AS shp
    WHERE shp.type = acct.type
);


Prompt:
Schema:
  orders (alias: mgr)(type, value, status, amount)
  shipments(date, salary, status, level)
Task: Find amount from orders where id appears in shipments entries with matching id.
SQL:

SELECT amount FROM orders AS mgr
WHERE id IN (
    SELECT id FROM shipments AS shp
    WHERE shp.id = mgr.id
);


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

SELECT salary FROM orders AS emp
WHERE code IN (
    SELECT code FROM suppliers AS rgn
    WHERE rgn.id = emp.id
);


Prompt:
Schema:
  regions (alias: schd)(date, code, id, level)
  categories(value, date, level, id)
Task: Find id from regions where a matching record exists in categories with the same level.
SQL:

SELECT id FROM regions AS schd
WHERE EXISTS (
    SELECT 1 FROM categories AS prod
    WHERE prod.level = schd.level
);


Prompt:
Schema:
  departments (alias: inv)(type, level, status, amount)
  tasks(value, name, date, code)
Task: Find salary from departments where code appears in tasks entries with matching status.
SQL:

SELECT salary FROM departments AS inv
WHERE code IN (
    SELECT code FROM tasks AS sale
    WHERE sale.status = inv.status
);


Prompt:
Schema:
  suppliers (alias: srvc)(salary, type, code, level)
  branches(amount, name, status, level)
Task: Select code from suppliers where type exists in branches for the same code.
SQL:

SELECT code FROM suppliers AS srvc
WHERE type IN (
    SELECT type FROM branches AS shp
    WHERE shp.code = srvc.code
);


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

SELECT name FROM projects AS budg
WHERE EXISTS (
    SELECT 1 FROM accounts AS prod
    WHERE prod.code = budg.code
);


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

SELECT value FROM suppliers AS ord
WHERE salary > (
    SELECT MIN(value) FROM products AS txn
    WHERE txn.code = ord.code
);


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

SELECT name FROM regions AS prod
WHERE value > (
    SELECT MAX(value) FROM employees AS shp
    WHERE shp.type = prod.type
);


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

SELECT id FROM tasks AS emp
WHERE level IN (
    SELECT level FROM invoices AS srvc
    WHERE srvc.status = emp.status
);


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

SELECT id FROM orders AS mgr
WHERE id IN (
    SELECT id FROM accounts AS ord
    WHERE ord.level = mgr.level
);


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

SELECT name FROM suppliers AS emp
WHERE id IN (
    SELECT id FROM shipments AS sale
    WHERE sale.status = emp.status
);


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

SELECT amount FROM customers AS lne
WHERE level IN (
    SELECT level FROM products AS txn
    WHERE txn.id = lne.id
);


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

SELECT code FROM suppliers AS whs
WHERE code IN (
    SELECT code FROM regions AS prod
    WHERE prod.type = whs.type
);


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

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


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

SELECT code FROM suppliers AS sale
WHERE EXISTS (
    SELECT 1 FROM customers AS mgr
    WHERE mgr.id = sale.id
);


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

SELECT salary FROM departments AS schd
WHERE amount > (
    SELECT MAX(salary) FROM tasks AS lne
    WHERE lne.status = schd.status
);


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

SELECT value FROM accounts AS dept
WHERE salary > (
    SELECT MAX(amount) FROM products AS txn
    WHERE txn.code = dept.code
);


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

SELECT name FROM transactions AS inv
WHERE salary > (
    SELECT AVG(salary) FROM regions AS empl
    WHERE empl.type = inv.type
);


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

SELECT amount FROM projects AS txn
WHERE value > (
    SELECT MIN(amount) FROM transactions AS dept
    WHERE dept.status = txn.status
);


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

SELECT name FROM invoices AS lne
WHERE EXISTS (
    SELECT 1 FROM categories AS rgn
    WHERE rgn.code = lne.code
);


Prompt:
Schema:
  products (alias: emp)(name, status, salary, date)
  categories(name, level, id, type)
Task: Select name from products where type exists in categories for the same status.
SQL:

SELECT name FROM products AS emp
WHERE type IN (
    SELECT type FROM categories AS ordr
    WHERE ordr.status = emp.status
);


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

SELECT salary FROM transactions AS cust
WHERE EXISTS (
    SELECT 1 FROM accounts AS budg
    WHERE budg.status = cust.status
);


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

SELECT value FROM tasks AS sale
WHERE EXISTS (
    SELECT 1 FROM customers AS budg
    WHERE budg.status = sale.status
);


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

SELECT salary FROM orders AS emp
WHERE amount > (
    SELECT MIN(amount) FROM products AS whs
    WHERE whs.id = emp.id
);


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

SELECT value FROM employees AS shp
WHERE type IN (
    SELECT type FROM tasks AS ord
    WHERE ord.code = shp.code
);


Prompt:
Schema:
  accounts (alias: emp)(level, value, id, amount)
  departments(date, status, code, level)
Task: Retrieve name from accounts with amount above the MIN(amount) of departments rows sharing the same status.
SQL:

SELECT name FROM accounts AS emp
WHERE amount > (
    SELECT MIN(amount) FROM departments AS ord
    WHERE ord.status = emp.status
);


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

SELECT code FROM categories AS rgn
WHERE EXISTS (
    SELECT 1 FROM branches AS budg
    WHERE budg.id = rgn.id
);


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

SELECT value FROM shipments AS srvc
WHERE EXISTS (
    SELECT 1 FROM accounts AS emp
    WHERE emp.status = srvc.status
);


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

SELECT amount FROM transactions AS empl
WHERE EXISTS (
    SELECT 1 FROM categories AS shp
    WHERE shp.level = empl.level
);


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

SELECT name FROM invoices AS whs
WHERE salary > (
    SELECT AVG(salary) FROM departments AS rgn
    WHERE rgn.status = whs.status
);


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

SELECT amount FROM regions AS budg
WHERE salary > (
    SELECT COUNT(amount) FROM tasks AS sale
    WHERE sale.id = budg.id
);


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

SELECT amount FROM branches AS budg
WHERE id IN (
    SELECT id FROM customers AS prod
    WHERE prod.type = budg.type
);


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

SELECT value FROM customers AS mgr
WHERE level IN (
    SELECT level FROM shipments AS acct
    WHERE acct.level = mgr.level
);


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

SELECT code FROM employees AS ord
WHERE EXISTS (
    SELECT 1 FROM branches AS emp
    WHERE emp.level = ord.level
);


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

SELECT id FROM products AS shp
WHERE amount > (
    SELECT MIN(salary) FROM shipments AS prod
    WHERE prod.type = shp.type
);


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

SELECT name FROM departments AS whs
WHERE amount > (
    SELECT SUM(value) FROM suppliers AS sale
    WHERE sale.id = whs.id
);


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

SELECT amount FROM suppliers AS dept
WHERE salary > (
    SELECT MAX(salary) FROM accounts AS ordr
    WHERE ordr.status = dept.status
);


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

SELECT name FROM products AS acct
WHERE EXISTS (
    SELECT 1 FROM employees AS txn
    WHERE txn.type = acct.type
);


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

SELECT id FROM shipments AS lne
WHERE EXISTS (
    SELECT 1 FROM transactions AS rgn
    WHERE rgn.level = lne.level
);


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

SELECT amount FROM products AS cust
WHERE EXISTS (
    SELECT 1 FROM tasks AS whs
    WHERE whs.code = cust.code
);


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

SELECT id FROM products AS mgr
WHERE EXISTS (
    SELECT 1 FROM departments AS ordr
    WHERE ordr.status = mgr.status
);


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

SELECT code FROM transactions AS lne
WHERE type IN (
    SELECT type FROM shipments AS shp
    WHERE shp.level = lne.level
);


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

SELECT amount FROM regions AS inv
WHERE EXISTS (
    SELECT 1 FROM shipments AS srvc
    WHERE srvc.id = inv.id
);


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

SELECT code FROM products AS schd
WHERE amount > (
    SELECT COUNT(salary) FROM warehouses AS empl
    WHERE empl.code = schd.code
);


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

SELECT name FROM accounts AS dept
WHERE type IN (
    SELECT type FROM suppliers AS ord
    WHERE ord.code = dept.code
);


Prompt:
Schema:
  transactions (alias: whs)(code, type, amount, value)
  regions(salary, type, amount, code)
Task: Retrieve code from transactions with amount above the AVG(value) of regions rows sharing the same status.
SQL:

SELECT code FROM transactions AS whs
WHERE amount > (
    SELECT AVG(value) FROM regions AS mgr
    WHERE mgr.status = whs.status
);


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

SELECT value FROM invoices AS budg
WHERE EXISTS (
    SELECT 1 FROM branches AS whs
    WHERE whs.level = budg.level
);


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

SELECT amount FROM branches AS dept
WHERE EXISTS (
    SELECT 1 FROM categories AS inv
    WHERE inv.level = dept.level
);


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

SELECT value FROM shipments AS budg
WHERE amount > (
    SELECT SUM(amount) FROM accounts AS rgn
    WHERE rgn.status = budg.status
);


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

SELECT code FROM shipments AS mgr
WHERE salary > (
    SELECT AVG(amount) FROM tasks AS acct
    WHERE acct.status = mgr.status
);


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

SELECT name FROM suppliers AS catg
WHERE amount > (
    SELECT MIN(salary) FROM regions AS budg
    WHERE budg.status = catg.status
);


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

SELECT salary FROM orders AS shp
WHERE EXISTS (
    SELECT 1 FROM regions AS empl
    WHERE empl.status = shp.status
);


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

SELECT salary FROM suppliers AS schd
WHERE value > (
    SELECT SUM(value) FROM accounts AS budg
    WHERE budg.id = schd.id
);


Prompt:
Schema:
  employees (alias: srvc)(id, code, type, amount)
  categories(amount, type, salary, level)
Task: Find code from employees where code appears in categories entries with matching level.
SQL:

SELECT code FROM employees AS srvc
WHERE code IN (
    SELECT code FROM categories AS acct
    WHERE acct.level = srvc.level
);


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

SELECT name FROM customers AS shp
WHERE status IN (
    SELECT status FROM suppliers AS prod
    WHERE prod.status = shp.status
);


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

SELECT value FROM customers AS catg
WHERE EXISTS (
    SELECT 1 FROM categories AS schd
    WHERE schd.status = catg.status
);


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

SELECT amount FROM transactions AS mgr
WHERE id IN (
    SELECT id FROM regions AS cust
    WHERE cust.id = mgr.id
);


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

SELECT value FROM branches AS shp
WHERE type IN (
    SELECT type FROM projects AS prod
    WHERE prod.type = shp.type
);


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

SELECT value FROM categories AS ordr
WHERE EXISTS (
    SELECT 1 FROM customers AS emp
    WHERE emp.level = ordr.level
);


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

SELECT salary FROM projects AS ord
WHERE amount > (
    SELECT COUNT(amount) FROM categories AS acct
    WHERE acct.level = ord.level
);


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

SELECT salary FROM categories AS ordr
WHERE salary > (
    SELECT MIN(value) FROM customers AS emp
    WHERE emp.code = ordr.code
);


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

SELECT amount FROM invoices AS emp
WHERE value > (
    SELECT COUNT(amount) FROM shipments AS srvc
    WHERE srvc.level = emp.level
);


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

SELECT id FROM projects AS catg
WHERE EXISTS (
    SELECT 1 FROM suppliers AS budg
    WHERE budg.level = catg.level
);


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

SELECT id FROM products AS txn
WHERE salary > (
    SELECT MIN(value) FROM warehouses AS empl
    WHERE empl.id = txn.id
);


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

SELECT id FROM customers AS acct
WHERE salary > (
    SELECT MIN(salary) FROM shipments AS mgr
    WHERE mgr.type = acct.type
);


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

SELECT salary FROM accounts AS emp
WHERE id IN (
    SELECT id FROM regions AS acct
    WHERE acct.level = emp.level
);


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

SELECT amount FROM customers AS acct
WHERE amount > (
    SELECT AVG(salary) FROM suppliers AS mgr
    WHERE mgr.type = acct.type
);


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

SELECT name FROM accounts AS budg
WHERE code IN (
    SELECT code FROM tasks AS ordr
    WHERE ordr.code = budg.code
);


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

SELECT amount FROM shipments AS prod
WHERE salary > (
    SELECT MIN(value) FROM customers AS ordr
    WHERE ordr.id = prod.id
);


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

SELECT amount FROM tasks AS schd
WHERE status IN (
    SELECT status FROM branches AS mgr
    WHERE mgr.status = schd.status
);


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

SELECT salary FROM orders AS budg
WHERE level IN (
    SELECT level FROM transactions AS empl
    WHERE empl.code = budg.code
);


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

SELECT amount FROM employees AS lne
WHERE EXISTS (
    SELECT 1 FROM transactions AS prod
    WHERE prod.id = lne.id
);


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

SELECT salary FROM suppliers AS empl
WHERE status IN (
    SELECT status FROM employees AS catg
    WHERE catg.type = empl.type
);


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

SELECT salary FROM suppliers AS inv
WHERE status IN (
    SELECT status FROM transactions AS sale
    WHERE sale.type = inv.type
);


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

SELECT amount FROM warehouses AS lne
WHERE amount > (
    SELECT MIN(value) FROM invoices AS catg
    WHERE catg.status = lne.status
);


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

SELECT name FROM orders AS ord
WHERE EXISTS (
    SELECT 1 FROM transactions AS shp
    WHERE shp.code = ord.code
);


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

SELECT salary FROM warehouses AS schd
WHERE EXISTS (
    SELECT 1 FROM accounts AS cust
    WHERE cust.id = schd.id
);


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

SELECT salary FROM transactions AS dept
WHERE EXISTS (
    SELECT 1 FROM products AS lne
    WHERE lne.code = dept.code
);


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

SELECT amount FROM customers AS ordr
WHERE value > (
    SELECT MAX(salary) FROM transactions AS cust
    WHERE cust.type = ordr.type
);


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

SELECT value FROM projects AS ord
WHERE type IN (
    SELECT type FROM orders AS txn
    WHERE txn.level = ord.level
);


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

SELECT salary FROM shipments AS txn
WHERE code IN (
    SELECT code FROM tasks AS cust
    WHERE cust.id = txn.id
);


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

SELECT amount FROM suppliers AS emp
WHERE amount > (
    SELECT SUM(salary) FROM orders AS shp
    WHERE shp.code = emp.code
);