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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM regions AS egiv
    WHERE egiv.code = ejof.code
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM tasks AS vmob
    WHERE vmob.status = kab.status
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM categories AS xnob
    WHERE xnob.status = znob.status
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM projects AS ikob
    WHERE ikob.level = vmob.level
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM regions AS jac
    WHERE jac.status = cif.status
);


Prompt:
Schema:
  employees (alias: bev)(type, code, id, level)
  branches(name, id, code, status)
Task: Find name from employees where salary exceeds the minimum value from branches for the same id.
SQL:

SELECT name FROM employees AS bev
WHERE salary > (
    SELECT MIN(value) FROM branches AS hac
    WHERE hac.id = bev.id
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM orders AS xnob
    WHERE xnob.level = fal.level
);


Prompt:
Schema:
  transactions (alias: gev)(level, name, type, code)
  accounts(id, type, status, code)
Task: Find salary from transactions where salary exceeds the count of amount from accounts for the same code.
SQL:

SELECT salary FROM transactions AS gev
WHERE salary > (
    SELECT COUNT(amount) FROM accounts AS cif
    WHERE cif.code = gev.code
);


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

SELECT name FROM staff AS xnob
WHERE salary > (
    SELECT MIN(salary) FROM orders AS dov
    WHERE dov.id = xnob.id
);


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

SELECT id FROM invoices AS fal
WHERE level IN (
    SELECT level FROM items AS okiv
    WHERE okiv.level = fal.level
);


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

SELECT id FROM transactions AS gev
WHERE status IN (
    SELECT status FROM tasks AS uliv
    WHERE uliv.code = gev.code
);


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

SELECT name FROM products AS nad
WHERE salary > (
    SELECT MIN(amount) FROM customers AS vnob
    WHERE vnob.id = nad.id
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM requests AS egiv
    WHERE egiv.id = gev.id
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.type = znob.type
);


Prompt:
Schema:
  invoices (alias: fal)(id, amount, status, name)
  departments(amount, value, code, type)
Task: Retrieve salary from invoices with amount above the AVG(salary) of departments rows sharing the same id.
SQL:

SELECT salary FROM invoices AS fal
WHERE amount > (
    SELECT AVG(salary) FROM departments AS vmob
    WHERE vmob.id = fal.id
);


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

SELECT code FROM customers AS lex
WHERE code IN (
    SELECT code FROM orders AS jac
    WHERE jac.status = lex.status
);


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

SELECT id FROM tasks AS znob
WHERE code IN (
    SELECT code FROM sales AS cif
    WHERE cif.level = znob.level
);


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

SELECT code FROM products AS nad
WHERE value > (
    SELECT MAX(salary) FROM items AS lex
    WHERE lex.level = nad.level
);


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

SELECT id FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM transactions AS vnob
    WHERE vnob.id = hac.id
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS nad
    WHERE nad.type = xnob.type
);


Prompt:
Schema:
  requests (alias: ejof)(type, date, value, salary)
  items(status, type, code, date)
Task: Find amount from requests where level appears in items entries with matching id.
SQL:

SELECT amount FROM requests AS ejof
WHERE level IN (
    SELECT level FROM items AS ikob
    WHERE ikob.id = ejof.id
);


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

SELECT amount FROM regions AS okiv
WHERE value > (
    SELECT COUNT(value) FROM orders AS dov
    WHERE dov.level = okiv.level
);


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

SELECT id FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM departments AS znob
    WHERE znob.type = bev.type
);


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

SELECT amount FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM tasks AS cif
    WHERE cif.status = kab.status
);


Prompt:
Schema:
  managers (alias: hac)(type, name, amount, salary)
  transactions(name, code, type, level)
Task: Find amount from managers where amount exceeds the maximum value from transactions for the same level.
SQL:

SELECT amount FROM managers AS hac
WHERE amount > (
    SELECT MAX(value) FROM transactions AS kab
    WHERE kab.level = hac.level
);


Prompt:
Schema:
  customers (alias: lex)(type, salary, code, value)
  managers(level, type, salary, status)
Task: Find salary from customers where status appears in managers entries with matching level.
SQL:

SELECT salary FROM customers AS lex
WHERE status IN (
    SELECT status FROM managers AS vmob
    WHERE vmob.level = lex.level
);


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

SELECT value FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM staff AS hac
    WHERE hac.id = vmob.id
);


Prompt:
Schema:
  tasks (alias: znob)(date, type, level, name)
  staff(name, amount, level, salary)
Task: Retrieve amount from tasks with value above the AVG(amount) of staff rows sharing the same code.
SQL:

SELECT amount FROM tasks AS znob
WHERE value > (
    SELECT AVG(amount) FROM staff AS agov
    WHERE agov.code = znob.code
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM shipments AS cif
    WHERE cif.status = xnob.status
);


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

SELECT amount FROM branches AS agov
WHERE level IN (
    SELECT level FROM tasks AS okiv
    WHERE okiv.status = agov.status
);


Prompt:
Schema:
  shipments (alias: vnob)(salary, type, value, date)
  staff(code, type, value, status)
Task: Retrieve name from shipments with value above the COUNT(value) of staff rows sharing the same code.
SQL:

SELECT name FROM shipments AS vnob
WHERE value > (
    SELECT COUNT(value) FROM staff AS egiv
    WHERE egiv.code = vnob.code
);


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

SELECT id FROM orders AS kab
WHERE level IN (
    SELECT level FROM requests AS lex
    WHERE lex.level = kab.level
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.id = cif.id
);


Prompt:
Schema:
  items (alias: ikob)(type, salary, level, value)
  requests(type, value, date, name)
Task: Retrieve amount from items with salary above the MIN(value) of requests rows sharing the same type.
SQL:

SELECT amount FROM items AS ikob
WHERE salary > (
    SELECT MIN(value) FROM requests AS vnob
    WHERE vnob.type = ikob.type
);


Prompt:
Schema:
  customers (alias: lex)(id, code, date, status)
  staff(status, type, id, amount)
Task: Find id from customers where amount exceeds the total value from staff for the same code.
SQL:

SELECT id FROM customers AS lex
WHERE amount > (
    SELECT SUM(value) FROM staff AS ejof
    WHERE ejof.code = lex.code
);


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

SELECT name FROM sales AS cif
WHERE value > (
    SELECT MAX(salary) FROM staff AS gev
    WHERE gev.code = cif.code
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS jac
    WHERE jac.code = bev.code
);


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

SELECT code FROM departments AS dov
WHERE salary > (
    SELECT AVG(amount) FROM managers AS kab
    WHERE kab.type = dov.type
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM staff AS ikob
    WHERE ikob.id = znob.id
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT AVG(salary) FROM schedules AS fal
    WHERE fal.level = okiv.level
);


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM managers AS fal
    WHERE fal.level = agov.level
);


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

SELECT value FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM customers AS vnob
    WHERE vnob.id = vmob.id
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM shipments AS fal
    WHERE fal.status = uliv.status
);


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

SELECT salary FROM requests AS ejof
WHERE level IN (
    SELECT level FROM tasks AS bev
    WHERE bev.id = ejof.id
);


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

SELECT value FROM managers AS hac
WHERE salary > (
    SELECT AVG(amount) FROM accounts AS bev
    WHERE bev.status = hac.status
);


Prompt:
Schema:
  items (alias: ikob)(amount, date, level, name)
  sales(amount, id, code, date)
Task: Select code from items where code exists in sales for the same id.
SQL:

SELECT code FROM items AS ikob
WHERE code IN (
    SELECT code FROM sales AS vnob
    WHERE vnob.id = ikob.id
);


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

SELECT id FROM projects AS uliv
WHERE salary > (
    SELECT COUNT(amount) FROM regions AS nad
    WHERE nad.level = uliv.level
);


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

SELECT salary FROM invoices AS fal
WHERE value > (
    SELECT MAX(salary) FROM regions AS egiv
    WHERE egiv.type = fal.type
);


Prompt:
Schema:
  schedules (alias: vmob)(level, value, amount, date)
  accounts(value, status, date, type)
Task: Find salary from schedules where status appears in accounts entries with matching type.
SQL:

SELECT salary FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM accounts AS vnob
    WHERE vnob.type = vmob.type
);


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

SELECT amount FROM transactions AS gev
WHERE amount > (
    SELECT MAX(salary) FROM tasks AS egiv
    WHERE egiv.type = gev.type
);


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

SELECT salary FROM transactions AS gev
WHERE type IN (
    SELECT type FROM requests AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM managers AS ikob
    WHERE ikob.code = gev.code
);


Prompt:
Schema:
  staff (alias: xnob)(date, name, amount, type)
  accounts(amount, level, date, id)
Task: Retrieve salary from staff with amount above the SUM(salary) of accounts rows sharing the same id.
SQL:

SELECT salary FROM staff AS xnob
WHERE amount > (
    SELECT SUM(salary) FROM accounts AS nad
    WHERE nad.id = xnob.id
);


Prompt:
Schema:
  accounts (alias: jac)(amount, value, salary, status)
  schedules(level, date, type, value)
Task: Find id from accounts where amount exceeds the count of salary from schedules for the same id.
SQL:

SELECT id FROM accounts AS jac
WHERE amount > (
    SELECT COUNT(salary) FROM schedules AS kab
    WHERE kab.id = jac.id
);


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

SELECT code FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM accounts AS uliv
    WHERE uliv.status = vnob.status
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM tasks AS ikob
    WHERE ikob.type = ejof.type
);


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

SELECT value FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM customers AS vmob
    WHERE vmob.type = vnob.type
);


Prompt:
Schema:
  staff (alias: xnob)(code, id, level, value)
  schedules(date, code, id, status)
Task: Find name from staff where value exceeds the average value from schedules for the same id.
SQL:

SELECT name FROM staff AS xnob
WHERE value > (
    SELECT AVG(value) FROM schedules AS jac
    WHERE jac.id = xnob.id
);


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

SELECT value FROM items AS ikob
WHERE level IN (
    SELECT level FROM products AS gev
    WHERE gev.id = ikob.id
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS jac
    WHERE jac.status = ejof.status
);


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

SELECT name FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM departments AS nad
    WHERE nad.id = vmob.id
);


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

SELECT id FROM managers AS hac
WHERE status IN (
    SELECT status FROM orders AS ejof
    WHERE ejof.type = hac.type
);


Prompt:
Schema:
  employees (alias: bev)(type, name, code, id)
  requests(id, type, value, name)
Task: Retrieve code from employees with salary above the COUNT(value) of requests rows sharing the same type.
SQL:

SELECT code FROM employees AS bev
WHERE salary > (
    SELECT COUNT(value) FROM requests AS vmob
    WHERE vmob.type = bev.type
);


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

SELECT amount FROM items AS ikob
WHERE status IN (
    SELECT status FROM regions AS nad
    WHERE nad.status = ikob.status
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM shipments AS vmob
    WHERE vmob.type = uliv.type
);


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

SELECT name FROM employees AS bev
WHERE type IN (
    SELECT type FROM transactions AS fal
    WHERE fal.level = bev.level
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM regions AS dov
    WHERE dov.code = jac.code
);


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT MIN(salary) FROM regions AS ejof
    WHERE ejof.level = agov.level
);


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

SELECT amount FROM customers AS lex
WHERE type IN (
    SELECT type FROM regions AS jac
    WHERE jac.type = lex.type
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.type = gev.type
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM invoices AS agov
    WHERE agov.type = lex.type
);


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

SELECT code FROM employees AS bev
WHERE status IN (
    SELECT status FROM items AS hac
    WHERE hac.status = bev.status
);


Prompt:
Schema:
  shipments (alias: vnob)(value, date, status, id)
  staff(level, value, status, type)
Task: Select value from shipments where id exists in staff for the same level.
SQL:

SELECT value FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM staff AS xnob
    WHERE xnob.level = vnob.level
);


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

SELECT id FROM regions AS okiv
WHERE value > (
    SELECT AVG(salary) FROM products AS ikob
    WHERE ikob.type = okiv.type
);


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

SELECT amount FROM items AS ikob
WHERE type IN (
    SELECT type FROM products AS egiv
    WHERE egiv.type = ikob.type
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS uliv
    WHERE uliv.status = ejof.status
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM transactions AS cif
    WHERE cif.status = bev.status
);


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

SELECT code FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(salary) FROM transactions AS agov
    WHERE agov.level = vmob.level
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS gev
    WHERE gev.status = dov.status
);


Prompt:
Schema:
  items (alias: ikob)(amount, id, value, code)
  regions(id, amount, value, type)
Task: Select code from items where level exists in regions for the same code.
SQL:

SELECT code FROM items AS ikob
WHERE level IN (
    SELECT level FROM regions AS hac
    WHERE hac.code = ikob.code
);


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

SELECT id FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM managers AS vnob
    WHERE vnob.type = egiv.type
);


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

SELECT id FROM tasks AS znob
WHERE salary > (
    SELECT AVG(salary) FROM orders AS vmob
    WHERE vmob.code = znob.code
);


Prompt:
Schema:
  products (alias: nad)(id, status, value, date)
  managers(value, status, code, date)
Task: Find amount from products where value exceeds the maximum salary from managers for the same status.
SQL:

SELECT amount FROM products AS nad
WHERE value > (
    SELECT MAX(salary) FROM managers AS jac
    WHERE jac.status = nad.status
);


Prompt:
Schema:
  projects (alias: uliv)(name, type, code, salary)
  orders(amount, name, id, type)
Task: Find value from projects where salary exceeds the minimum salary from orders for the same code.
SQL:

SELECT value FROM projects AS uliv
WHERE salary > (
    SELECT MIN(salary) FROM orders AS agov
    WHERE agov.code = uliv.code
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM products AS vmob
    WHERE vmob.type = vnob.type
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS nad
    WHERE nad.level = lex.level
);


Prompt:
Schema:
  categories (alias: egiv)(value, status, salary, amount)
  requests(name, id, status, salary)
Task: Select salary from categories where id exists in requests for the same id.
SQL:

SELECT salary FROM categories AS egiv
WHERE id IN (
    SELECT id FROM requests AS lex
    WHERE lex.id = egiv.id
);


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

SELECT salary FROM staff AS xnob
WHERE code IN (
    SELECT code FROM shipments AS gev
    WHERE gev.level = xnob.level
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.level = hac.level
);


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

SELECT value FROM shipments AS vnob
WHERE value > (
    SELECT MIN(amount) FROM tasks AS ikob
    WHERE ikob.status = vnob.status
);


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM orders AS bev
    WHERE bev.id = ejof.id
);


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

SELECT salary FROM departments AS dov
WHERE salary > (
    SELECT AVG(salary) FROM invoices AS fal
    WHERE fal.id = dov.id
);


Prompt:
Schema:
  schedules (alias: vmob)(status, id, value, name)
  departments(id, status, salary, type)
Task: Find salary from schedules where value exceeds the minimum amount from departments for the same level.
SQL:

SELECT salary FROM schedules AS vmob
WHERE value > (
    SELECT MIN(amount) FROM departments AS gev
    WHERE gev.level = vmob.level
);


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

SELECT amount FROM invoices AS fal
WHERE value > (
    SELECT SUM(amount) FROM regions AS hac
    WHERE hac.id = fal.id
);


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

SELECT amount FROM items AS ikob
WHERE id IN (
    SELECT id FROM categories AS egiv
    WHERE egiv.id = ikob.id
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM invoices AS hac
    WHERE hac.level = nad.level
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS nad
    WHERE nad.status = vnob.status
);


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

SELECT salary FROM regions AS okiv
WHERE code IN (
    SELECT code FROM requests AS vmob
    WHERE vmob.type = okiv.type
);


Prompt:
Schema:
  managers (alias: hac)(date, amount, value, status)
  staff(type, id, value, amount)
Task: Find value from managers where type appears in staff entries with matching type.
SQL:

SELECT value FROM managers AS hac
WHERE type IN (
    SELECT type FROM staff AS uliv
    WHERE uliv.type = hac.type
);


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

SELECT salary FROM branches AS agov
WHERE salary > (
    SELECT AVG(amount) FROM items AS nad
    WHERE nad.status = agov.status
);


Prompt:
Schema:
  tasks (alias: znob)(name, id, salary, date)
  requests(amount, level, name, code)
Task: Find salary from tasks where salary exceeds the total salary from requests for the same status.
SQL:

SELECT salary FROM tasks AS znob
WHERE salary > (
    SELECT SUM(salary) FROM requests AS egiv
    WHERE egiv.status = znob.status
);


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

SELECT amount FROM regions AS okiv
WHERE value > (
    SELECT AVG(value) FROM invoices AS xnob
    WHERE xnob.code = okiv.code
);


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

SELECT id FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM orders AS hac
    WHERE hac.level = znob.level
);


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

SELECT amount FROM staff AS xnob
WHERE status IN (
    SELECT status FROM transactions AS okiv
    WHERE okiv.level = xnob.level
);


Prompt:
Schema:
  categories (alias: egiv)(status, amount, level, code)
  orders(code, type, amount, value)
Task: Find value from categories where type appears in orders entries with matching status.
SQL:

SELECT value FROM categories AS egiv
WHERE type IN (
    SELECT type FROM orders AS cif
    WHERE cif.status = egiv.status
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM invoices AS vnob
    WHERE vnob.level = uliv.level
);


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

SELECT code FROM managers AS hac
WHERE code IN (
    SELECT code FROM branches AS egiv
    WHERE egiv.type = hac.type
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM customers AS vnob
    WHERE vnob.level = cif.level
);


Prompt:
Schema:
  items (alias: ikob)(value, name, status, type)
  schedules(status, value, name, code)
Task: Find value from items where a matching record exists in schedules with the same level.
SQL:

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.level = ikob.level
);


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

SELECT id FROM orders AS kab
WHERE type IN (
    SELECT type FROM projects AS ikob
    WHERE ikob.level = kab.level
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM staff AS cif
    WHERE cif.type = uliv.type
);


Prompt:
Schema:
  tasks (alias: znob)(type, name, salary, code)
  schedules(level, code, amount, status)
Task: Find name from tasks where value exceeds the minimum salary from schedules for the same level.
SQL:

SELECT name FROM tasks AS znob
WHERE value > (
    SELECT MIN(salary) FROM schedules AS ikob
    WHERE ikob.level = znob.level
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM tasks AS vmob
    WHERE vmob.status = dov.status
);


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

SELECT id FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM schedules AS bev
    WHERE bev.code = kab.code
);


Prompt:
Schema:
  departments (alias: dov)(date, id, amount, value)
  employees(type, amount, value, id)
Task: Find id from departments where amount exceeds the minimum value from employees for the same status.
SQL:

SELECT id FROM departments AS dov
WHERE amount > (
    SELECT MIN(value) FROM employees AS okiv
    WHERE okiv.status = dov.status
);


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

SELECT code FROM products AS nad
WHERE code IN (
    SELECT code FROM accounts AS hac
    WHERE hac.type = nad.type
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS bev
    WHERE bev.id = vnob.id
);


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

SELECT value FROM orders AS kab
WHERE level IN (
    SELECT level FROM employees AS egiv
    WHERE egiv.id = kab.id
);


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

SELECT name FROM projects AS uliv
WHERE id IN (
    SELECT id FROM categories AS ejof
    WHERE ejof.status = uliv.status
);


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

SELECT amount FROM transactions AS gev
WHERE status IN (
    SELECT status FROM regions AS nad
    WHERE nad.id = gev.id
);


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

SELECT code FROM orders AS kab
WHERE value > (
    SELECT MAX(value) FROM branches AS ejof
    WHERE ejof.id = kab.id
);


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

SELECT id FROM managers AS hac
WHERE level IN (
    SELECT level FROM accounts AS okiv
    WHERE okiv.id = hac.id
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM departments AS gev
    WHERE gev.level = agov.level
);


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

SELECT id FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM employees AS dov
    WHERE dov.type = kab.type
);


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

SELECT id FROM projects AS uliv
WHERE amount > (
    SELECT AVG(value) FROM schedules AS kab
    WHERE kab.id = uliv.id
);


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

SELECT amount FROM transactions AS gev
WHERE value > (
    SELECT MIN(salary) FROM tasks AS hac
    WHERE hac.code = gev.code
);


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

SELECT id FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM categories AS bev
    WHERE bev.status = hac.status
);


Prompt:
Schema:
  products (alias: nad)(type, amount, name, level)
  branches(id, salary, amount, status)
Task: Find id from products where salary exceeds the maximum salary from branches for the same id.
SQL:

SELECT id FROM products AS nad
WHERE salary > (
    SELECT MAX(salary) FROM branches AS vmob
    WHERE vmob.id = nad.id
);


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT AVG(salary) FROM regions AS lex
    WHERE lex.level = bev.level
);


Prompt:
Schema:
  accounts (alias: jac)(name, amount, code, level)
  sales(name, level, salary, amount)
Task: Retrieve id from accounts with amount above the MIN(salary) of sales rows sharing the same status.
SQL:

SELECT id FROM accounts AS jac
WHERE amount > (
    SELECT MIN(salary) FROM sales AS xnob
    WHERE xnob.status = jac.status
);


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

SELECT code FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM tasks AS uliv
    WHERE uliv.level = vmob.level
);


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

SELECT salary FROM managers AS hac
WHERE value > (
    SELECT MAX(salary) FROM employees AS okiv
    WHERE okiv.code = hac.code
);


Prompt:
Schema:
  schedules (alias: vmob)(name, code, id, value)
  transactions(date, name, type, code)
Task: Find code from schedules where value exceeds the minimum salary from transactions for the same code.
SQL:

SELECT code FROM schedules AS vmob
WHERE value > (
    SELECT MIN(salary) FROM transactions AS nad
    WHERE nad.code = vmob.code
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM transactions AS fal
    WHERE fal.status = ejof.status
);


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

SELECT salary FROM shipments AS vnob
WHERE value > (
    SELECT COUNT(salary) FROM tasks AS bev
    WHERE bev.code = vnob.code
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM regions AS egiv
    WHERE egiv.code = znob.code
);


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

SELECT name FROM regions AS okiv
WHERE status IN (
    SELECT status FROM managers AS dov
    WHERE dov.level = okiv.level
);


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

SELECT amount FROM customers AS lex
WHERE salary > (
    SELECT MIN(value) FROM shipments AS egiv
    WHERE egiv.status = lex.status
);


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

SELECT value FROM categories AS egiv
WHERE id IN (
    SELECT id FROM departments AS fal
    WHERE fal.status = egiv.status
);


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM transactions AS lex
    WHERE lex.id = znob.id
);


Prompt:
Schema:
  items (alias: ikob)(salary, level, name, value)
  categories(date, status, amount, salary)
Task: Retrieve id from items with salary above the SUM(salary) of categories rows sharing the same id.
SQL:

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT SUM(salary) FROM categories AS vmob
    WHERE vmob.id = ikob.id
);


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

SELECT amount FROM accounts AS jac
WHERE id IN (
    SELECT id FROM tasks AS egiv
    WHERE egiv.level = jac.level
);


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

SELECT id FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM employees AS nad
    WHERE nad.code = jac.code
);


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

SELECT amount FROM products AS nad
WHERE id IN (
    SELECT id FROM branches AS znob
    WHERE znob.type = nad.type
);


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

SELECT id FROM departments AS dov
WHERE status IN (
    SELECT status FROM regions AS fal
    WHERE fal.id = dov.id
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM tasks AS jac
    WHERE jac.status = gev.status
);


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

SELECT code FROM employees AS bev
WHERE salary > (
    SELECT AVG(value) FROM products AS nad
    WHERE nad.code = bev.code
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM schedules AS hac
    WHERE hac.code = cif.code
);


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

SELECT code FROM categories AS egiv
WHERE level IN (
    SELECT level FROM regions AS hac
    WHERE hac.type = egiv.type
);


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

SELECT value FROM accounts AS jac
WHERE level IN (
    SELECT level FROM regions AS egiv
    WHERE egiv.code = jac.code
);


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM requests AS jac
    WHERE jac.id = vmob.id
);


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

SELECT id FROM accounts AS jac
WHERE type IN (
    SELECT type FROM departments AS gev
    WHERE gev.code = jac.code
);


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

SELECT id FROM departments AS dov
WHERE salary > (
    SELECT MAX(value) FROM requests AS uliv
    WHERE uliv.level = dov.level
);


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

SELECT salary FROM sales AS cif
WHERE salary > (
    SELECT MAX(salary) FROM accounts AS bev
    WHERE bev.code = cif.code
);


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

SELECT name FROM staff AS xnob
WHERE amount > (
    SELECT MAX(salary) FROM employees AS vnob
    WHERE vnob.id = xnob.id
);


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

SELECT value FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM invoices AS jac
    WHERE jac.code = egiv.code
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM customers AS uliv
    WHERE uliv.code = dov.code
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM products AS xnob
    WHERE xnob.code = fal.code
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM shipments AS lex
    WHERE lex.status = ikob.status
);


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

SELECT id FROM items AS ikob
WHERE id IN (
    SELECT id FROM regions AS jac
    WHERE jac.level = ikob.level
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM tasks AS agov
    WHERE agov.status = vmob.status
);


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

SELECT code FROM items AS ikob
WHERE id IN (
    SELECT id FROM invoices AS cif
    WHERE cif.type = ikob.type
);


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

SELECT name FROM customers AS lex
WHERE value > (
    SELECT COUNT(value) FROM transactions AS agov
    WHERE agov.status = lex.status
);


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

SELECT name FROM invoices AS fal
WHERE type IN (
    SELECT type FROM tasks AS hac
    WHERE hac.code = fal.code
);


Prompt:
Schema:
  projects (alias: uliv)(name, level, type, code)
  orders(value, level, status, type)
Task: Find salary from projects where value exceeds the maximum value from orders for the same level.
SQL:

SELECT salary FROM projects AS uliv
WHERE value > (
    SELECT MAX(value) FROM orders AS vmob
    WHERE vmob.level = uliv.level
);


Prompt:
Schema:
  staff (alias: xnob)(status, level, code, id)
  sales(level, value, type, code)
Task: Find id from staff where code appears in sales entries with matching id.
SQL:

SELECT id FROM staff AS xnob
WHERE code IN (
    SELECT code FROM sales AS agov
    WHERE agov.id = xnob.id
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM orders AS ejof
    WHERE ejof.code = bev.code
);


Prompt:
Schema:
  projects (alias: uliv)(level, name, id, type)
  requests(id, type, code, name)
Task: Retrieve salary from projects with salary above the MIN(salary) of requests rows sharing the same level.
SQL:

SELECT salary FROM projects AS uliv
WHERE salary > (
    SELECT MIN(salary) FROM requests AS kab
    WHERE kab.level = uliv.level
);


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

SELECT salary FROM regions AS okiv
WHERE id IN (
    SELECT id FROM schedules AS kab
    WHERE kab.code = okiv.code
);


Prompt:
Schema:
  schedules (alias: vmob)(type, id, name, status)
  projects(value, date, status, id)
Task: Find amount from schedules where amount exceeds the count of amount from projects for the same code.
SQL:

SELECT amount FROM schedules AS vmob
WHERE amount > (
    SELECT COUNT(amount) FROM projects AS lex
    WHERE lex.code = vmob.code
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM employees AS fal
    WHERE fal.level = lex.level
);


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

SELECT name FROM transactions AS gev
WHERE salary > (
    SELECT COUNT(salary) FROM regions AS hac
    WHERE hac.type = gev.type
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM departments AS agov
    WHERE agov.id = nad.id
);


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

SELECT salary FROM categories AS egiv
WHERE id IN (
    SELECT id FROM departments AS vmob
    WHERE vmob.id = egiv.id
);


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

SELECT value FROM branches AS agov
WHERE amount > (
    SELECT COUNT(amount) FROM orders AS lex
    WHERE lex.type = agov.type
);


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

SELECT code FROM projects AS uliv
WHERE amount > (
    SELECT AVG(salary) FROM regions AS kab
    WHERE kab.type = uliv.type
);


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

SELECT salary FROM invoices AS fal
WHERE amount > (
    SELECT SUM(amount) FROM customers AS ejof
    WHERE ejof.level = fal.level
);


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

SELECT code FROM managers AS hac
WHERE type IN (
    SELECT type FROM branches AS xnob
    WHERE xnob.status = hac.status
);


Prompt:
Schema:
  schedules (alias: vmob)(status, type, level, amount)
  projects(id, value, type, code)
Task: Find salary from schedules where amount exceeds the count of amount from projects for the same level.
SQL:

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT COUNT(amount) FROM projects AS gev
    WHERE gev.level = vmob.level
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM invoices AS ikob
    WHERE ikob.type = gev.type
);


Prompt:
Schema:
  items (alias: ikob)(name, date, amount, salary)
  requests(level, date, code, name)
Task: Find salary from items where value exceeds the maximum salary from requests for the same type.
SQL:

SELECT salary FROM items AS ikob
WHERE value > (
    SELECT MAX(salary) FROM requests AS ejof
    WHERE ejof.type = ikob.type
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM customers AS okiv
    WHERE okiv.type = gev.type
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.type = nad.type
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM shipments AS ejof
    WHERE ejof.code = okiv.code
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS cif
    WHERE cif.status = dov.status
);


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

SELECT code FROM accounts AS jac
WHERE type IN (
    SELECT type FROM staff AS vmob
    WHERE vmob.type = jac.type
);


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT AVG(salary) FROM projects AS kab
    WHERE kab.id = bev.id
);


Prompt:
Schema:
  sales (alias: cif)(status, type, id, date)
  customers(amount, level, type, date)
Task: Find amount from sales where code appears in customers entries with matching type.
SQL:

SELECT amount FROM sales AS cif
WHERE code IN (
    SELECT code FROM customers AS egiv
    WHERE egiv.type = cif.type
);


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

SELECT code FROM invoices AS fal
WHERE salary > (
    SELECT MIN(salary) FROM customers AS hac
    WHERE hac.status = fal.status
);


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

SELECT amount FROM transactions AS gev
WHERE amount > (
    SELECT MAX(value) FROM employees AS uliv
    WHERE uliv.type = gev.type
);


Prompt:
Schema:
  tasks (alias: znob)(type, name, salary, date)
  items(salary, name, type, level)
Task: Find name from tasks where status appears in items entries with matching status.
SQL:

SELECT name FROM tasks AS znob
WHERE status IN (
    SELECT status FROM items AS okiv
    WHERE okiv.status = znob.status
);


Prompt:
Schema:
  schedules (alias: vmob)(code, value, status, amount)
  products(salary, level, code, value)
Task: Select amount from schedules where type exists in products for the same code.
SQL:

SELECT amount FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM products AS okiv
    WHERE okiv.code = vmob.code
);


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

SELECT id FROM regions AS okiv
WHERE type IN (
    SELECT type FROM products AS agov
    WHERE agov.id = okiv.id
);


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

SELECT name FROM staff AS xnob
WHERE salary > (
    SELECT MAX(value) FROM branches AS uliv
    WHERE uliv.level = xnob.level
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT MAX(amount) FROM products AS xnob
    WHERE xnob.level = okiv.level
);


Prompt:
Schema:
  managers (alias: hac)(status, level, value, date)
  branches(value, status, level, code)
Task: Find value from managers where status appears in branches entries with matching type.
SQL:

SELECT value FROM managers AS hac
WHERE status IN (
    SELECT status FROM branches AS uliv
    WHERE uliv.type = hac.type
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM employees AS jac
    WHERE jac.level = uliv.level
);


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

SELECT name FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM shipments AS dov
    WHERE dov.level = jac.level
);


Prompt:
Schema:
  orders (alias: kab)(code, name, status, date)
  accounts(id, status, amount, type)
Task: Find code from orders where salary exceeds the total amount from accounts for the same status.
SQL:

SELECT code FROM orders AS kab
WHERE salary > (
    SELECT SUM(amount) FROM accounts AS gev
    WHERE gev.status = kab.status
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM customers AS ejof
    WHERE ejof.code = uliv.code
);


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

SELECT code FROM staff AS xnob
WHERE status IN (
    SELECT status FROM customers AS ikob
    WHERE ikob.status = xnob.status
);


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

SELECT salary FROM customers AS lex
WHERE level IN (
    SELECT level FROM managers AS nad
    WHERE nad.level = lex.level
);


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

SELECT salary FROM shipments AS vnob
WHERE amount > (
    SELECT AVG(salary) FROM employees AS agov
    WHERE agov.status = vnob.status
);


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

SELECT id FROM items AS ikob
WHERE code IN (
    SELECT code FROM projects AS agov
    WHERE agov.code = ikob.code
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM customers AS fal
    WHERE fal.type = vmob.type
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(salary) FROM regions AS lex
    WHERE lex.code = vmob.code
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM accounts AS znob
    WHERE znob.code = dov.code
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM customers AS egiv
    WHERE egiv.level = jac.level
);


Prompt:
Schema:
  products (alias: nad)(date, code, name, level)
  managers(level, type, code, salary)
Task: Retrieve name from products with salary above the MAX(salary) of managers rows sharing the same status.
SQL:

SELECT name FROM products AS nad
WHERE salary > (
    SELECT MAX(salary) FROM managers AS gev
    WHERE gev.status = nad.status
);


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

SELECT name FROM invoices AS fal
WHERE level IN (
    SELECT level FROM categories AS znob
    WHERE znob.type = fal.type
);


Prompt:
Schema:
  branches (alias: agov)(value, status, level, type)
  regions(amount, status, level, code)
Task: Find salary from branches where value exceeds the maximum amount from regions for the same level.
SQL:

SELECT salary FROM branches AS agov
WHERE value > (
    SELECT MAX(amount) FROM regions AS znob
    WHERE znob.level = agov.level
);


Prompt:
Schema:
  shipments (alias: vnob)(status, type, amount, date)
  items(name, type, date, code)
Task: Retrieve value from shipments with amount above the AVG(value) of items rows sharing the same id.
SQL:

SELECT value FROM shipments AS vnob
WHERE amount > (
    SELECT AVG(value) FROM items AS egiv
    WHERE egiv.id = vnob.id
);


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.code = vmob.code
);


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

SELECT salary FROM departments AS dov
WHERE salary > (
    SELECT SUM(amount) FROM projects AS bev
    WHERE bev.code = dov.code
);


Prompt:
Schema:
  products (alias: nad)(value, type, level, salary)
  accounts(name, code, id, type)
Task: Find code from products where value exceeds the maximum value from accounts for the same id.
SQL:

SELECT code FROM products AS nad
WHERE value > (
    SELECT MAX(value) FROM accounts AS agov
    WHERE agov.id = nad.id
);


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

SELECT id FROM customers AS lex
WHERE type IN (
    SELECT type FROM regions AS xnob
    WHERE xnob.type = lex.type
);


Prompt:
Schema:
  categories (alias: egiv)(id, value, date, type)
  accounts(amount, date, value, id)
Task: Find value from categories where salary exceeds the total value from accounts for the same status.
SQL:

SELECT value FROM categories AS egiv
WHERE salary > (
    SELECT SUM(value) FROM accounts AS agov
    WHERE agov.status = egiv.status
);


Prompt:
Schema:
  schedules (alias: vmob)(code, level, date, value)
  items(amount, id, status, name)
Task: Find code from schedules where status appears in items entries with matching id.
SQL:

SELECT code FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM items AS ejof
    WHERE ejof.id = vmob.id
);


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

SELECT amount FROM projects AS uliv
WHERE type IN (
    SELECT type FROM branches AS jac
    WHERE jac.level = uliv.level
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM customers AS ikob
    WHERE ikob.level = kab.level
);


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

SELECT value FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS kab
    WHERE kab.status = xnob.status
);


Prompt:
Schema:
  invoices (alias: fal)(code, salary, value, name)
  staff(type, date, code, id)
Task: Find name from invoices where value exceeds the total amount from staff for the same code.
SQL:

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT SUM(amount) FROM staff AS okiv
    WHERE okiv.code = fal.code
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.id = cif.id
);


Prompt:
Schema:
  regions (alias: okiv)(status, value, name, date)
  sales(salary, type, value, date)
Task: Find name from regions where a matching record exists in sales with the same status.
SQL:

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM sales AS jac
    WHERE jac.status = okiv.status
);


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

SELECT amount FROM sales AS cif
WHERE code IN (
    SELECT code FROM transactions AS lex
    WHERE lex.type = cif.type
);


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

SELECT value FROM invoices AS fal
WHERE amount > (
    SELECT AVG(value) FROM categories AS dov
    WHERE dov.code = fal.code
);


Prompt:
Schema:
  schedules (alias: vmob)(type, status, salary, id)
  sales(level, id, name, amount)
Task: Retrieve salary from schedules with amount above the AVG(salary) of sales rows sharing the same status.
SQL:

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(salary) FROM sales AS bev
    WHERE bev.status = vmob.status
);


Prompt:
Schema:
  staff (alias: xnob)(code, name, amount, date)
  invoices(id, code, level, amount)
Task: Find salary from staff where type appears in invoices entries with matching status.
SQL:

SELECT salary FROM staff AS xnob
WHERE type IN (
    SELECT type FROM invoices AS dov
    WHERE dov.status = xnob.status
);


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

SELECT name FROM tasks AS znob
WHERE code IN (
    SELECT code FROM invoices AS fal
    WHERE fal.status = znob.status
);


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

SELECT name FROM branches AS agov
WHERE id IN (
    SELECT id FROM schedules AS okiv
    WHERE okiv.type = agov.type
);


Prompt:
Schema:
  regions (alias: okiv)(value, level, status, type)
  accounts(code, type, name, value)
Task: Retrieve name from regions with value above the MAX(salary) of accounts rows sharing the same code.
SQL:

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT MAX(salary) FROM accounts AS ikob
    WHERE ikob.code = okiv.code
);


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

SELECT salary FROM customers AS lex
WHERE code IN (
    SELECT code FROM shipments AS ikob
    WHERE ikob.level = lex.level
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM staff AS egiv
    WHERE egiv.status = bev.status
);


Prompt:
Schema:
  sales (alias: cif)(code, date, type, level)
  branches(amount, type, salary, code)
Task: Find name from sales where salary exceeds the count of value from branches for the same code.
SQL:

SELECT name FROM sales AS cif
WHERE salary > (
    SELECT COUNT(value) FROM branches AS fal
    WHERE fal.code = cif.code
);


Prompt:
Schema:
  customers (alias: lex)(date, amount, level, name)
  staff(type, status, amount, level)
Task: Retrieve code from customers with amount above the AVG(amount) of staff rows sharing the same status.
SQL:

SELECT code FROM customers AS lex
WHERE amount > (
    SELECT AVG(amount) FROM staff AS cif
    WHERE cif.status = lex.status
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT AVG(amount) FROM branches AS bev
    WHERE bev.level = hac.level
);


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

SELECT salary FROM categories AS egiv
WHERE amount > (
    SELECT AVG(value) FROM items AS bev
    WHERE bev.status = egiv.status
);


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

SELECT name FROM accounts AS jac
WHERE type IN (
    SELECT type FROM managers AS ikob
    WHERE ikob.code = jac.code
);


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

SELECT id FROM employees AS bev
WHERE salary > (
    SELECT COUNT(value) FROM transactions AS vmob
    WHERE vmob.status = bev.status
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM customers AS dov
    WHERE dov.type = okiv.type
);


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS agov
    WHERE agov.level = vnob.level
);


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM projects AS okiv
    WHERE okiv.type = vmob.type
);


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

SELECT code FROM invoices AS fal
WHERE type IN (
    SELECT type FROM projects AS cif
    WHERE cif.type = fal.type
);


Prompt:
Schema:
  requests (alias: ejof)(status, level, type, date)
  managers(value, status, id, amount)
Task: Find id from requests where id appears in managers entries with matching id.
SQL:

SELECT id FROM requests AS ejof
WHERE id IN (
    SELECT id FROM managers AS dov
    WHERE dov.id = ejof.id
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS jac
    WHERE jac.id = vnob.id
);


Prompt:
Schema:
  staff (alias: xnob)(code, level, status, name)
  items(level, amount, salary, code)
Task: Find salary from staff where level appears in items entries with matching id.
SQL:

SELECT salary FROM staff AS xnob
WHERE level IN (
    SELECT level FROM items AS okiv
    WHERE okiv.id = xnob.id
);


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

SELECT id FROM employees AS bev
WHERE level IN (
    SELECT level FROM staff AS uliv
    WHERE uliv.code = bev.code
);


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

SELECT id FROM categories AS egiv
WHERE status IN (
    SELECT status FROM shipments AS kab
    WHERE kab.id = egiv.id
);


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

SELECT salary FROM orders AS kab
WHERE value > (
    SELECT AVG(value) FROM items AS vmob
    WHERE vmob.code = kab.code
);


Prompt:
Schema:
  employees (alias: bev)(value, type, amount, name)
  transactions(date, salary, type, code)
Task: Select name from employees where status exists in transactions for the same type.
SQL:

SELECT name FROM employees AS bev
WHERE status IN (
    SELECT status FROM transactions AS cif
    WHERE cif.type = bev.type
);


Prompt:
Schema:
  branches (alias: agov)(name, amount, date, level)
  employees(salary, status, date, code)
Task: Find value from branches where salary exceeds the maximum amount from employees for the same level.
SQL:

SELECT value FROM branches AS agov
WHERE salary > (
    SELECT MAX(amount) FROM employees AS znob
    WHERE znob.level = agov.level
);


Prompt:
Schema:
  items (alias: ikob)(id, value, level, code)
  accounts(amount, date, id, type)
Task: Retrieve name from items with amount above the AVG(amount) of accounts rows sharing the same level.
SQL:

SELECT name FROM items AS ikob
WHERE amount > (
    SELECT AVG(amount) FROM accounts AS fal
    WHERE fal.level = ikob.level
);


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

SELECT salary FROM branches AS agov
WHERE level IN (
    SELECT level FROM regions AS vmob
    WHERE vmob.type = agov.type
);


Prompt:
Schema:
  requests (alias: ejof)(id, status, type, name)
  sales(date, code, name, salary)
Task: Select salary from requests where level exists in sales for the same status.
SQL:

SELECT salary FROM requests AS ejof
WHERE level IN (
    SELECT level FROM sales AS uliv
    WHERE uliv.status = ejof.status
);


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

SELECT code FROM products AS nad
WHERE amount > (
    SELECT AVG(value) FROM categories AS jac
    WHERE jac.id = nad.id
);


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

SELECT name FROM accounts AS jac
WHERE code IN (
    SELECT code FROM schedules AS okiv
    WHERE okiv.code = jac.code
);


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

SELECT salary FROM accounts AS jac
WHERE code IN (
    SELECT code FROM branches AS lex
    WHERE lex.code = jac.code
);


Prompt:
Schema:
  schedules (alias: vmob)(id, salary, type, value)
  shipments(salary, id, value, status)
Task: Find salary from schedules where a matching record exists in shipments with the same type.
SQL:

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM shipments AS okiv
    WHERE okiv.type = vmob.type
);


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

SELECT value FROM customers AS lex
WHERE amount > (
    SELECT MAX(value) FROM employees AS okiv
    WHERE okiv.code = lex.code
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.status = nad.status
);


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

SELECT name FROM staff AS xnob
WHERE type IN (
    SELECT type FROM invoices AS lex
    WHERE lex.id = xnob.id
);


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

SELECT id FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM items AS xnob
    WHERE xnob.level = vnob.level
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM orders AS okiv
    WHERE okiv.code = ikob.code
);


Prompt:
Schema:
  departments (alias: dov)(status, code, id, date)
  schedules(salary, type, code, value)
Task: Find salary from departments where code appears in schedules entries with matching level.
SQL:

SELECT salary FROM departments AS dov
WHERE code IN (
    SELECT code FROM schedules AS bev
    WHERE bev.level = dov.level
);


Prompt:
Schema:
  managers (alias: hac)(value, date, salary, amount)
  regions(code, salary, amount, id)
Task: Find id from managers where amount exceeds the maximum amount from regions for the same status.
SQL:

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT MAX(amount) FROM regions AS vmob
    WHERE vmob.status = hac.status
);


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

SELECT value FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM departments AS ikob
    WHERE ikob.status = egiv.status
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS egiv
    WHERE egiv.code = dov.code
);


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

SELECT name FROM customers AS lex
WHERE id IN (
    SELECT id FROM invoices AS egiv
    WHERE egiv.code = lex.code
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM departments AS dov
    WHERE dov.level = vmob.level
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM schedules AS ikob
    WHERE ikob.type = cif.type
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM categories AS vmob
    WHERE vmob.status = ikob.status
);


Prompt:
Schema:
  items (alias: ikob)(date, salary, value, level)
  tasks(status, id, code, level)
Task: Retrieve code from items with salary above the SUM(salary) of tasks rows sharing the same code.
SQL:

SELECT code FROM items AS ikob
WHERE salary > (
    SELECT SUM(salary) FROM tasks AS gev
    WHERE gev.code = ikob.code
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM departments AS agov
    WHERE agov.status = hac.status
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS fal
    WHERE fal.code = gev.code
);


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

SELECT amount FROM items AS ikob
WHERE code IN (
    SELECT code FROM projects AS egiv
    WHERE egiv.level = ikob.level
);


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

SELECT code FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM tasks AS kab
    WHERE kab.type = agov.type
);


Prompt:
Schema:
  customers (alias: lex)(status, level, name, code)
  requests(salary, amount, code, level)
Task: Find salary from customers where salary exceeds the total salary from requests for the same code.
SQL:

SELECT salary FROM customers AS lex
WHERE salary > (
    SELECT SUM(salary) FROM requests AS hac
    WHERE hac.code = lex.code
);


Prompt:
Schema:
  managers (alias: hac)(salary, level, amount, code)
  shipments(date, level, value, amount)
Task: Find value from managers where amount exceeds the count of salary from shipments for the same status.
SQL:

SELECT value FROM managers AS hac
WHERE amount > (
    SELECT COUNT(salary) FROM shipments AS jac
    WHERE jac.status = hac.status
);


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

SELECT value FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.type = fal.type
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM employees AS cif
    WHERE cif.type = dov.type
);


Prompt:
Schema:
  transactions (alias: gev)(id, level, value, status)
  shipments(code, amount, status, date)
Task: Retrieve salary from transactions with amount above the AVG(amount) of shipments rows sharing the same level.
SQL:

SELECT salary FROM transactions AS gev
WHERE amount > (
    SELECT AVG(amount) FROM shipments AS fal
    WHERE fal.level = gev.level
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM staff AS fal
    WHERE fal.type = uliv.type
);


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

SELECT salary FROM branches AS agov
WHERE salary > (
    SELECT AVG(amount) FROM managers AS lex
    WHERE lex.code = agov.code
);


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

SELECT amount FROM employees AS bev
WHERE code IN (
    SELECT code FROM requests AS kab
    WHERE kab.type = bev.type
);


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

SELECT code FROM regions AS okiv
WHERE id IN (
    SELECT id FROM invoices AS agov
    WHERE agov.code = okiv.code
);


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

SELECT value FROM transactions AS gev
WHERE type IN (
    SELECT type FROM projects AS vmob
    WHERE vmob.type = gev.type
);


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

SELECT id FROM customers AS lex
WHERE level IN (
    SELECT level FROM departments AS okiv
    WHERE okiv.code = lex.code
);


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

SELECT id FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM accounts AS dov
    WHERE dov.level = bev.level
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM products AS lex
    WHERE lex.level = vnob.level
);


Prompt:
Schema:
  invoices (alias: fal)(status, code, name, amount)
  sales(salary, type, level, status)
Task: Find id from invoices where salary exceeds the maximum salary from sales for the same status.
SQL:

SELECT id FROM invoices AS fal
WHERE salary > (
    SELECT MAX(salary) FROM sales AS egiv
    WHERE egiv.status = fal.status
);


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

SELECT salary FROM requests AS ejof
WHERE status IN (
    SELECT status FROM customers AS fal
    WHERE fal.code = ejof.code
);


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

SELECT code FROM branches AS agov
WHERE type IN (
    SELECT type FROM customers AS vnob
    WHERE vnob.type = agov.type
);


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

SELECT code FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM shipments AS jac
    WHERE jac.status = vmob.status
);


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

SELECT value FROM regions AS okiv
WHERE type IN (
    SELECT type FROM requests AS hac
    WHERE hac.status = okiv.status
);


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

SELECT salary FROM projects AS uliv
WHERE type IN (
    SELECT type FROM accounts AS bev
    WHERE bev.code = uliv.code
);


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

SELECT name FROM orders AS kab
WHERE value > (
    SELECT COUNT(salary) FROM sales AS okiv
    WHERE okiv.status = kab.status
);


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

SELECT code FROM invoices AS fal
WHERE value > (
    SELECT COUNT(value) FROM transactions AS egiv
    WHERE egiv.level = fal.level
);