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

SELECT name FROM regions AS okiv
WHERE level IN (
    SELECT level FROM shipments AS cif
    WHERE cif.level = okiv.level
);


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

SELECT salary FROM projects AS uliv
WHERE type IN (
    SELECT type FROM orders AS kab
    WHERE kab.type = uliv.type
);


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

SELECT code FROM invoices AS fal
WHERE salary > (
    SELECT MAX(value) FROM staff AS kab
    WHERE kab.id = fal.id
);


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

SELECT value FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM invoices AS kab
    WHERE kab.status = vnob.status
);


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

SELECT salary FROM shipments AS vnob
WHERE amount > (
    SELECT AVG(salary) FROM requests AS uliv
    WHERE uliv.code = vnob.code
);


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT MAX(amount) FROM requests AS fal
    WHERE fal.status = znob.status
);


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

SELECT value FROM branches AS agov
WHERE amount > (
    SELECT COUNT(salary) FROM staff AS hac
    WHERE hac.id = agov.id
);


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

SELECT amount FROM accounts AS jac
WHERE value > (
    SELECT COUNT(value) FROM sales AS agov
    WHERE agov.code = jac.code
);


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

SELECT salary FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM accounts AS vmob
    WHERE vmob.code = vnob.code
);


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

SELECT id FROM regions AS okiv
WHERE id IN (
    SELECT id FROM accounts AS bev
    WHERE bev.code = okiv.code
);


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

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


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

SELECT name FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM regions AS cif
    WHERE cif.level = vnob.level
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM projects AS ejof
    WHERE ejof.type = agov.type
);


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

SELECT amount FROM orders AS kab
WHERE id IN (
    SELECT id FROM categories AS ejof
    WHERE ejof.type = kab.type
);


Prompt:
Schema:
  staff (alias: xnob)(status, code, value, date)
  transactions(value, code, type, level)
Task: Find amount from staff where value exceeds the minimum salary from transactions for the same status.
SQL:

SELECT amount FROM staff AS xnob
WHERE value > (
    SELECT MIN(salary) FROM transactions AS bev
    WHERE bev.status = xnob.status
);


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM projects AS ikob
    WHERE ikob.type = cif.type
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM invoices AS cif
    WHERE cif.level = nad.level
);


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

SELECT amount FROM projects AS uliv
WHERE value > (
    SELECT SUM(salary) FROM transactions AS egiv
    WHERE egiv.status = uliv.status
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT MAX(amount) FROM invoices AS znob
    WHERE znob.type = kab.type
);


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

SELECT amount FROM requests AS ejof
WHERE value > (
    SELECT AVG(salary) FROM items AS bev
    WHERE bev.type = ejof.type
);


Prompt:
Schema:
  employees (alias: bev)(salary, id, name, amount)
  staff(value, amount, name, salary)
Task: Find amount from employees where salary exceeds the minimum value from staff for the same id.
SQL:

SELECT amount FROM employees AS bev
WHERE salary > (
    SELECT MIN(value) FROM staff AS dov
    WHERE dov.id = bev.id
);


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM branches AS okiv
    WHERE okiv.status = bev.status
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM invoices AS znob
    WHERE znob.code = kab.code
);


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT COUNT(value) FROM invoices AS egiv
    WHERE egiv.code = cif.code
);


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

SELECT code FROM products AS nad
WHERE level IN (
    SELECT level FROM transactions AS gev
    WHERE gev.level = nad.level
);


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

SELECT salary FROM orders AS kab
WHERE code IN (
    SELECT code FROM sales AS gev
    WHERE gev.id = kab.id
);


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

SELECT salary FROM branches AS agov
WHERE status IN (
    SELECT status FROM customers AS hac
    WHERE hac.id = agov.id
);


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

SELECT salary FROM accounts AS jac
WHERE salary > (
    SELECT MAX(salary) FROM schedules AS gev
    WHERE gev.id = jac.id
);


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

SELECT id FROM transactions AS gev
WHERE status IN (
    SELECT status FROM branches AS okiv
    WHERE okiv.level = gev.level
);


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

SELECT name FROM accounts AS jac
WHERE code IN (
    SELECT code FROM shipments AS cif
    WHERE cif.type = jac.type
);


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

SELECT code FROM orders AS kab
WHERE code IN (
    SELECT code FROM managers AS vmob
    WHERE vmob.level = kab.level
);


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

SELECT code FROM staff AS xnob
WHERE salary > (
    SELECT SUM(value) FROM categories AS nad
    WHERE nad.status = xnob.status
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS fal
    WHERE fal.level = xnob.level
);


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

SELECT name FROM staff AS xnob
WHERE id IN (
    SELECT id FROM tasks AS fal
    WHERE fal.code = xnob.code
);


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

SELECT amount FROM regions AS okiv
WHERE type IN (
    SELECT type FROM projects AS agov
    WHERE agov.status = okiv.status
);


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

SELECT id FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM invoices AS agov
    WHERE agov.id = znob.id
);


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

SELECT id FROM regions AS okiv
WHERE id IN (
    SELECT id FROM managers AS dov
    WHERE dov.type = okiv.type
);


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM branches AS znob
    WHERE znob.id = vmob.id
);


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

SELECT salary FROM staff AS xnob
WHERE code IN (
    SELECT code FROM categories AS fal
    WHERE fal.level = xnob.level
);


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

SELECT name FROM staff AS xnob
WHERE status IN (
    SELECT status FROM schedules AS hac
    WHERE hac.type = xnob.type
);


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

SELECT code FROM tasks AS znob
WHERE level IN (
    SELECT level FROM shipments AS jac
    WHERE jac.level = znob.level
);


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

SELECT amount FROM items AS ikob
WHERE salary > (
    SELECT MAX(value) FROM requests AS agov
    WHERE agov.code = ikob.code
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT MIN(amount) FROM transactions AS jac
    WHERE jac.id = okiv.id
);


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

SELECT value FROM requests AS ejof
WHERE code IN (
    SELECT code FROM projects AS cif
    WHERE cif.id = ejof.id
);


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

SELECT salary FROM requests AS ejof
WHERE id IN (
    SELECT id FROM regions AS okiv
    WHERE okiv.level = ejof.level
);


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM schedules AS fal
    WHERE fal.type = egiv.type
);


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

SELECT name FROM items AS ikob
WHERE value > (
    SELECT COUNT(salary) FROM schedules AS egiv
    WHERE egiv.code = ikob.code
);


Prompt:
Schema:
  products (alias: nad)(amount, value, date, name)
  staff(salary, status, value, type)
Task: Find code from products where value exceeds the minimum salary from staff for the same status.
SQL:

SELECT code FROM products AS nad
WHERE value > (
    SELECT MIN(salary) FROM staff AS xnob
    WHERE xnob.status = nad.status
);


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

SELECT amount FROM sales AS cif
WHERE amount > (
    SELECT COUNT(amount) FROM items AS okiv
    WHERE okiv.type = cif.type
);


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

SELECT id FROM requests AS ejof
WHERE level IN (
    SELECT level FROM invoices AS okiv
    WHERE okiv.status = ejof.status
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM shipments AS bev
    WHERE bev.status = kab.status
);


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

SELECT code FROM staff AS xnob
WHERE level IN (
    SELECT level FROM products AS dov
    WHERE dov.status = xnob.status
);


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

SELECT amount FROM branches AS agov
WHERE status IN (
    SELECT status FROM customers AS ejof
    WHERE ejof.level = agov.level
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM employees AS vnob
    WHERE vnob.id = gev.id
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM accounts AS okiv
    WHERE okiv.type = lex.type
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM items AS nad
    WHERE nad.level = lex.level
);


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

SELECT id FROM regions AS okiv
WHERE value > (
    SELECT SUM(value) FROM staff AS bev
    WHERE bev.id = okiv.id
);


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

SELECT code FROM projects AS uliv
WHERE code IN (
    SELECT code FROM items AS jac
    WHERE jac.id = uliv.id
);


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

SELECT code FROM tasks AS znob
WHERE salary > (
    SELECT MAX(value) FROM sales AS uliv
    WHERE uliv.status = znob.status
);


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

SELECT code FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.status = hac.status
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM employees AS ikob
    WHERE ikob.id = okiv.id
);


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

SELECT amount FROM managers AS hac
WHERE salary > (
    SELECT SUM(amount) FROM projects AS kab
    WHERE kab.code = hac.code
);


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

SELECT id FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM invoices AS lex
    WHERE lex.status = vmob.status
);


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

SELECT code FROM transactions AS gev
WHERE value > (
    SELECT SUM(amount) FROM customers AS vnob
    WHERE vnob.code = gev.code
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM sales AS agov
    WHERE agov.code = xnob.code
);


Prompt:
Schema:
  customers (alias: lex)(type, status, value, salary)
  products(value, name, type, amount)
Task: Find value from customers where value exceeds the count of value from products for the same code.
SQL:

SELECT value FROM customers AS lex
WHERE value > (
    SELECT COUNT(value) FROM products AS bev
    WHERE bev.code = lex.code
);


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

SELECT code FROM managers AS hac
WHERE status IN (
    SELECT status FROM regions AS cif
    WHERE cif.type = hac.type
);


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

SELECT salary FROM regions AS okiv
WHERE type IN (
    SELECT type FROM projects AS xnob
    WHERE xnob.status = okiv.status
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM tasks AS nad
    WHERE nad.code = gev.code
);


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

SELECT amount FROM tasks AS znob
WHERE value > (
    SELECT COUNT(amount) FROM schedules AS okiv
    WHERE okiv.code = znob.code
);


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

SELECT salary FROM managers AS hac
WHERE code IN (
    SELECT code FROM categories AS lex
    WHERE lex.level = hac.level
);


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

SELECT code FROM departments AS dov
WHERE type IN (
    SELECT type FROM invoices AS okiv
    WHERE okiv.status = dov.status
);


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

SELECT name FROM projects AS uliv
WHERE id IN (
    SELECT id FROM orders AS fal
    WHERE fal.type = uliv.type
);


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

SELECT name FROM items AS ikob
WHERE value > (
    SELECT MIN(salary) FROM departments AS egiv
    WHERE egiv.code = ikob.code
);


Prompt:
Schema:
  employees (alias: bev)(code, amount, level, type)
  sales(type, status, amount, name)
Task: Find amount from employees where salary exceeds the count of amount from sales for the same level.
SQL:

SELECT amount FROM employees AS bev
WHERE salary > (
    SELECT COUNT(amount) FROM sales AS fal
    WHERE fal.level = bev.level
);


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

SELECT name FROM transactions AS gev
WHERE id IN (
    SELECT id FROM branches AS jac
    WHERE jac.code = gev.code
);


Prompt:
Schema:
  requests (alias: ejof)(type, level, value, id)
  items(value, type, salary, code)
Task: Find id from requests where a matching record exists in items with the same id.
SQL:

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM items AS okiv
    WHERE okiv.id = ejof.id
);


Prompt:
Schema:
  branches (alias: agov)(name, status, date, value)
  sales(date, salary, value, type)
Task: Select salary from branches where status exists in sales for the same status.
SQL:

SELECT salary FROM branches AS agov
WHERE status IN (
    SELECT status FROM sales AS lex
    WHERE lex.status = agov.status
);


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

SELECT salary FROM categories AS egiv
WHERE type IN (
    SELECT type FROM managers AS cif
    WHERE cif.type = egiv.type
);


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

SELECT salary FROM sales AS cif
WHERE id IN (
    SELECT id FROM products AS jac
    WHERE jac.level = cif.level
);


Prompt:
Schema:
  tasks (alias: znob)(type, name, code, value)
  categories(amount, id, level, value)
Task: Find name from tasks where amount exceeds the count of value from categories for the same status.
SQL:

SELECT name FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(value) FROM categories AS fal
    WHERE fal.status = znob.status
);


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM requests AS okiv
    WHERE okiv.level = hac.level
);


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

SELECT id FROM orders AS kab
WHERE value > (
    SELECT SUM(value) FROM invoices AS hac
    WHERE hac.code = kab.code
);


Prompt:
Schema:
  staff (alias: xnob)(salary, date, value, level)
  orders(status, type, name, level)
Task: Find value from staff where value exceeds the minimum salary from orders for the same type.
SQL:

SELECT value FROM staff AS xnob
WHERE value > (
    SELECT MIN(salary) FROM orders AS ikob
    WHERE ikob.type = xnob.type
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM staff AS vnob
    WHERE vnob.level = ikob.level
);


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

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


Prompt:
Schema:
  orders (alias: kab)(id, level, name, status)
  departments(code, id, amount, date)
Task: Find id from orders where value exceeds the count of amount from departments for the same id.
SQL:

SELECT id FROM orders AS kab
WHERE value > (
    SELECT COUNT(amount) FROM departments AS uliv
    WHERE uliv.id = kab.id
);


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

SELECT amount FROM orders AS kab
WHERE status IN (
    SELECT status FROM shipments AS vmob
    WHERE vmob.type = kab.type
);


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

SELECT value FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM products AS agov
    WHERE agov.status = vnob.status
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT MAX(value) FROM transactions AS dov
    WHERE dov.status = hac.status
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM customers AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT amount FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM shipments AS okiv
    WHERE okiv.status = vmob.status
);


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

SELECT code FROM tasks AS znob
WHERE level IN (
    SELECT level FROM branches AS ejof
    WHERE ejof.status = znob.status
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM categories AS xnob
    WHERE xnob.type = hac.type
);


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

SELECT amount FROM departments AS dov
WHERE value > (
    SELECT AVG(salary) FROM products AS bev
    WHERE bev.type = dov.type
);


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

SELECT value FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM staff AS agov
    WHERE agov.level = fal.level
);


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

SELECT value FROM schedules AS vmob
WHERE salary > (
    SELECT MAX(salary) FROM items AS gev
    WHERE gev.code = vmob.code
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM departments AS agov
    WHERE agov.type = uliv.type
);


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

SELECT name FROM accounts AS jac
WHERE amount > (
    SELECT MIN(value) FROM regions AS vmob
    WHERE vmob.level = jac.level
);


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

SELECT code FROM invoices AS fal
WHERE level IN (
    SELECT level FROM requests AS okiv
    WHERE okiv.code = fal.code
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM schedules AS cif
    WHERE cif.code = jac.code
);


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

SELECT name FROM products AS nad
WHERE id IN (
    SELECT id FROM staff AS vnob
    WHERE vnob.level = nad.level
);


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

SELECT salary FROM departments AS dov
WHERE level IN (
    SELECT level FROM invoices AS uliv
    WHERE uliv.id = dov.id
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM categories AS jac
    WHERE jac.code = vmob.code
);


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

SELECT id FROM accounts AS jac
WHERE level IN (
    SELECT level FROM products AS gev
    WHERE gev.level = jac.level
);


Prompt:
Schema:
  staff (alias: xnob)(value, type, id, code)
  invoices(value, id, amount, date)
Task: Retrieve code from staff with value above the SUM(amount) of invoices rows sharing the same code.
SQL:

SELECT code FROM staff AS xnob
WHERE value > (
    SELECT SUM(amount) FROM invoices AS jac
    WHERE jac.code = xnob.code
);


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

SELECT salary FROM customers AS lex
WHERE code IN (
    SELECT code FROM departments AS nad
    WHERE nad.id = lex.id
);


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

SELECT value FROM shipments AS vnob
WHERE salary > (
    SELECT AVG(value) FROM transactions AS okiv
    WHERE okiv.status = vnob.status
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS agov
    WHERE agov.id = xnob.id
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM invoices AS xnob
    WHERE xnob.code = vmob.code
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM tasks AS kab
    WHERE kab.status = lex.status
);


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

SELECT id FROM products AS nad
WHERE level IN (
    SELECT level FROM orders AS xnob
    WHERE xnob.id = nad.id
);


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

SELECT name FROM customers AS lex
WHERE level IN (
    SELECT level FROM employees AS bev
    WHERE bev.code = lex.code
);


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

SELECT value FROM orders AS kab
WHERE salary > (
    SELECT AVG(salary) FROM branches AS ikob
    WHERE ikob.id = kab.id
);


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

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


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM employees AS hac
    WHERE hac.type = lex.type
);


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM tasks AS xnob
    WHERE xnob.status = vmob.status
);


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

SELECT name FROM employees AS bev
WHERE salary > (
    SELECT SUM(salary) FROM transactions AS jac
    WHERE jac.type = bev.type
);


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

SELECT name FROM sales AS cif
WHERE code IN (
    SELECT code FROM customers AS fal
    WHERE fal.code = cif.code
);


Prompt:
Schema:
  requests (alias: ejof)(status, level, salary, code)
  invoices(name, value, code, salary)
Task: Find id from requests where salary exceeds the total salary from invoices for the same type.
SQL:

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT SUM(salary) FROM invoices AS uliv
    WHERE uliv.type = ejof.type
);


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

SELECT code FROM regions AS okiv
WHERE amount > (
    SELECT AVG(value) FROM employees AS agov
    WHERE agov.status = okiv.status
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM departments AS vmob
    WHERE vmob.status = xnob.status
);


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

SELECT name FROM products AS nad
WHERE id IN (
    SELECT id FROM shipments AS ejof
    WHERE ejof.status = nad.status
);


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

SELECT salary FROM requests AS ejof
WHERE type IN (
    SELECT type FROM products AS dov
    WHERE dov.status = ejof.status
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.status = znob.status
);


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

SELECT id FROM managers AS hac
WHERE value > (
    SELECT COUNT(value) FROM tasks AS gev
    WHERE gev.level = hac.level
);


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

SELECT name FROM requests AS ejof
WHERE value > (
    SELECT AVG(salary) FROM employees AS cif
    WHERE cif.type = ejof.type
);


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

SELECT value FROM orders AS kab
WHERE amount > (
    SELECT SUM(salary) FROM managers AS okiv
    WHERE okiv.level = kab.level
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM managers AS cif
    WHERE cif.code = jac.code
);


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

SELECT amount FROM categories AS egiv
WHERE type IN (
    SELECT type FROM transactions AS okiv
    WHERE okiv.status = egiv.status
);


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

SELECT amount FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM requests AS znob
    WHERE znob.type = vmob.type
);


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM products AS hac
    WHERE hac.id = agov.id
);


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

SELECT amount FROM accounts AS jac
WHERE level IN (
    SELECT level FROM employees AS bev
    WHERE bev.level = jac.level
);


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

SELECT name FROM branches AS agov
WHERE salary > (
    SELECT MIN(salary) FROM schedules AS jac
    WHERE jac.id = agov.id
);


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

SELECT value FROM projects AS uliv
WHERE id IN (
    SELECT id FROM employees AS gev
    WHERE gev.status = uliv.status
);


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

SELECT value FROM tasks AS znob
WHERE salary > (
    SELECT MIN(value) FROM branches AS jac
    WHERE jac.code = znob.code
);


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

SELECT value FROM staff AS xnob
WHERE value > (
    SELECT SUM(amount) FROM transactions AS znob
    WHERE znob.code = xnob.code
);


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

SELECT id FROM transactions AS gev
WHERE code IN (
    SELECT code FROM managers AS nad
    WHERE nad.id = gev.id
);


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

SELECT id FROM invoices AS fal
WHERE code IN (
    SELECT code FROM accounts AS znob
    WHERE znob.code = fal.code
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM requests AS dov
    WHERE dov.status = gev.status
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM requests AS znob
    WHERE znob.status = lex.status
);


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

SELECT name FROM items AS ikob
WHERE id IN (
    SELECT id FROM schedules AS xnob
    WHERE xnob.id = ikob.id
);


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

SELECT id FROM transactions AS gev
WHERE amount > (
    SELECT MAX(salary) FROM departments AS vmob
    WHERE vmob.type = gev.type
);


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

SELECT salary FROM transactions AS gev
WHERE level IN (
    SELECT level FROM schedules AS uliv
    WHERE uliv.level = gev.level
);


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

SELECT value FROM transactions AS gev
WHERE level IN (
    SELECT level FROM invoices AS jac
    WHERE jac.code = gev.code
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS dov
    WHERE dov.code = hac.code
);


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

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


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

SELECT id FROM invoices AS fal
WHERE id IN (
    SELECT id FROM requests AS ejof
    WHERE ejof.level = fal.level
);


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

SELECT id FROM invoices AS fal
WHERE level IN (
    SELECT level FROM customers AS hac
    WHERE hac.type = fal.type
);


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

SELECT code FROM managers AS hac
WHERE salary > (
    SELECT MIN(value) FROM orders AS fal
    WHERE fal.code = hac.code
);


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

SELECT code FROM categories AS egiv
WHERE status IN (
    SELECT status FROM departments AS nad
    WHERE nad.id = egiv.id
);


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

SELECT id FROM managers AS hac
WHERE type IN (
    SELECT type FROM customers AS gev
    WHERE gev.code = hac.code
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM products AS dov
    WHERE dov.status = jac.status
);


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

SELECT amount FROM transactions AS gev
WHERE type IN (
    SELECT type FROM schedules AS agov
    WHERE agov.code = gev.code
);


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

SELECT id FROM employees AS bev
WHERE amount > (
    SELECT MAX(salary) FROM tasks AS vmob
    WHERE vmob.level = bev.level
);


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

SELECT name FROM orders AS kab
WHERE salary > (
    SELECT AVG(amount) FROM departments AS znob
    WHERE znob.level = kab.level
);


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

SELECT id FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM employees AS lex
    WHERE lex.status = egiv.status
);


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

SELECT code FROM tasks AS znob
WHERE salary > (
    SELECT MIN(value) FROM projects AS gev
    WHERE gev.level = znob.level
);


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

SELECT salary FROM items AS ikob
WHERE salary > (
    SELECT MIN(salary) FROM sales AS hac
    WHERE hac.id = ikob.id
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS hac
    WHERE hac.status = vnob.status
);


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

SELECT amount FROM managers AS hac
WHERE status IN (
    SELECT status FROM regions AS lex
    WHERE lex.id = hac.id
);


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

SELECT code FROM employees AS bev
WHERE code IN (
    SELECT code FROM shipments AS uliv
    WHERE uliv.status = bev.status
);


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

SELECT name FROM products AS nad
WHERE amount > (
    SELECT AVG(amount) FROM requests AS fal
    WHERE fal.code = nad.code
);


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

SELECT salary FROM regions AS okiv
WHERE salary > (
    SELECT COUNT(value) FROM tasks AS uliv
    WHERE uliv.type = okiv.type
);


Prompt:
Schema:
  regions (alias: okiv)(value, code, type, amount)
  requests(status, name, date, amount)
Task: Find amount from regions where value exceeds the count of salary from requests for the same id.
SQL:

SELECT amount FROM regions AS okiv
WHERE value > (
    SELECT COUNT(salary) FROM requests AS jac
    WHERE jac.id = okiv.id
);


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

SELECT name FROM items AS ikob
WHERE code IN (
    SELECT code FROM managers AS egiv
    WHERE egiv.level = ikob.level
);


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

SELECT name FROM orders AS kab
WHERE value > (
    SELECT COUNT(amount) FROM accounts AS vmob
    WHERE vmob.level = kab.level
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.type = nad.type
);


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM categories AS kab
    WHERE kab.id = okiv.id
);


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

SELECT salary FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(amount) FROM regions AS znob
    WHERE znob.code = ejof.code
);


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

SELECT amount FROM items AS ikob
WHERE amount > (
    SELECT MAX(amount) FROM invoices AS hac
    WHERE hac.id = ikob.id
);


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

SELECT salary FROM accounts AS jac
WHERE salary > (
    SELECT AVG(amount) FROM invoices AS vnob
    WHERE vnob.type = jac.type
);


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

SELECT code FROM products AS nad
WHERE level IN (
    SELECT level FROM items AS znob
    WHERE znob.status = nad.status
);


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

SELECT code FROM customers AS lex
WHERE type IN (
    SELECT type FROM products AS vmob
    WHERE vmob.status = lex.status
);


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

SELECT value FROM managers AS hac
WHERE level IN (
    SELECT level FROM branches AS kab
    WHERE kab.level = hac.level
);


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

SELECT value FROM orders AS kab
WHERE status IN (
    SELECT status FROM managers AS lex
    WHERE lex.status = kab.status
);


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

SELECT salary FROM categories AS egiv
WHERE code IN (
    SELECT code FROM products AS vmob
    WHERE vmob.code = egiv.code
);


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

SELECT value FROM employees AS bev
WHERE id IN (
    SELECT id FROM categories AS jac
    WHERE jac.code = bev.code
);


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

SELECT id FROM managers AS hac
WHERE code IN (
    SELECT code FROM schedules AS jac
    WHERE jac.code = hac.code
);


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

SELECT salary FROM departments AS dov
WHERE value > (
    SELECT COUNT(value) FROM shipments AS vnob
    WHERE vnob.type = dov.type
);


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT SUM(amount) FROM customers AS kab
    WHERE kab.status = znob.status
);


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

SELECT id FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM projects AS okiv
    WHERE okiv.code = ikob.code
);


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

SELECT id FROM branches AS agov
WHERE value > (
    SELECT MIN(value) FROM departments AS bev
    WHERE bev.type = agov.type
);


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

SELECT id FROM orders AS kab
WHERE value > (
    SELECT COUNT(salary) FROM branches AS dov
    WHERE dov.type = kab.type
);


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

SELECT amount FROM schedules AS vmob
WHERE salary > (
    SELECT SUM(amount) FROM transactions AS uliv
    WHERE uliv.type = vmob.type
);


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

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


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

SELECT amount FROM sales AS cif
WHERE type IN (
    SELECT type FROM branches AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT code FROM accounts AS jac
WHERE id IN (
    SELECT id FROM staff AS agov
    WHERE agov.level = jac.level
);


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

SELECT amount FROM schedules AS vmob
WHERE value > (
    SELECT COUNT(amount) FROM managers AS agov
    WHERE agov.level = vmob.level
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM projects AS fal
    WHERE fal.status = bev.status
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM sales AS ejof
    WHERE ejof.status = znob.status
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM branches AS okiv
    WHERE okiv.id = jac.id
);


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

SELECT value FROM branches AS agov
WHERE level IN (
    SELECT level FROM regions AS dov
    WHERE dov.level = agov.level
);


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

SELECT value FROM departments AS dov
WHERE status IN (
    SELECT status FROM shipments AS znob
    WHERE znob.status = dov.status
);


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

SELECT amount FROM projects AS uliv
WHERE status IN (
    SELECT status FROM transactions AS bev
    WHERE bev.type = uliv.type
);


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

SELECT value FROM items AS ikob
WHERE level IN (
    SELECT level FROM categories AS gev
    WHERE gev.status = ikob.status
);


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM schedules AS ejof
    WHERE ejof.code = okiv.code
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM regions AS ejof
    WHERE ejof.code = hac.code
);


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

SELECT id FROM customers AS lex
WHERE level IN (
    SELECT level FROM branches AS znob
    WHERE znob.level = lex.level
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.level = gev.level
);


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

SELECT amount FROM invoices AS fal
WHERE id IN (
    SELECT id FROM items AS hac
    WHERE hac.status = fal.status
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.type = okiv.type
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM invoices AS cif
    WHERE cif.status = hac.status
);


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

SELECT salary FROM customers AS lex
WHERE code IN (
    SELECT code FROM requests AS jac
    WHERE jac.id = lex.id
);


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

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


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

SELECT id FROM departments AS dov
WHERE id IN (
    SELECT id FROM staff AS xnob
    WHERE xnob.type = dov.type
);


Prompt:
Schema:
  transactions (alias: gev)(amount, level, type, salary)
  branches(salary, id, date, type)
Task: Find code from transactions where salary exceeds the maximum amount from branches for the same code.
SQL:

SELECT code FROM transactions AS gev
WHERE salary > (
    SELECT MAX(amount) FROM branches AS fal
    WHERE fal.code = gev.code
);


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM schedules AS bev
    WHERE bev.id = uliv.id
);


Prompt:
Schema:
  customers (alias: lex)(name, level, id, salary)
  employees(salary, name, date, code)
Task: Find name from customers where amount exceeds the count of amount from employees for the same code.
SQL:

SELECT name FROM customers AS lex
WHERE amount > (
    SELECT COUNT(amount) FROM employees AS nad
    WHERE nad.code = lex.code
);


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

SELECT code FROM products AS nad
WHERE amount > (
    SELECT MAX(amount) FROM transactions AS fal
    WHERE fal.level = nad.level
);


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

SELECT amount FROM invoices AS fal
WHERE amount > (
    SELECT AVG(amount) FROM orders AS cif
    WHERE cif.level = fal.level
);


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

SELECT salary FROM sales AS cif
WHERE status IN (
    SELECT status FROM products AS vmob
    WHERE vmob.id = cif.id
);


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

SELECT amount FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM employees AS vmob
    WHERE vmob.status = okiv.status
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.type = xnob.type
);


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

SELECT salary FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM staff AS agov
    WHERE agov.type = vnob.type
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM branches AS nad
    WHERE nad.id = okiv.id
);


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

SELECT salary FROM items AS ikob
WHERE status IN (
    SELECT status FROM customers AS nad
    WHERE nad.code = ikob.code
);


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

SELECT amount FROM regions AS okiv
WHERE id IN (
    SELECT id FROM invoices AS gev
    WHERE gev.type = okiv.type
);


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

SELECT code FROM customers AS lex
WHERE amount > (
    SELECT MAX(value) FROM managers AS egiv
    WHERE egiv.level = lex.level
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM staff AS kab
    WHERE kab.code = okiv.code
);


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

SELECT amount FROM employees AS bev
WHERE salary > (
    SELECT MIN(amount) FROM accounts AS nad
    WHERE nad.level = bev.level
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS dov
    WHERE dov.id = fal.id
);


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

SELECT code FROM tasks AS znob
WHERE amount > (
    SELECT AVG(salary) FROM requests AS uliv
    WHERE uliv.id = znob.id
);


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

SELECT id FROM staff AS xnob
WHERE value > (
    SELECT COUNT(salary) FROM invoices AS znob
    WHERE znob.type = xnob.type
);


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

SELECT amount FROM sales AS cif
WHERE value > (
    SELECT AVG(salary) FROM shipments AS ikob
    WHERE ikob.code = cif.code
);


Prompt:
Schema:
  accounts (alias: jac)(status, value, id, name)
  transactions(amount, id, name, level)
Task: Find salary from accounts where amount exceeds the minimum value from transactions for the same level.
SQL:

SELECT salary FROM accounts AS jac
WHERE amount > (
    SELECT MIN(value) FROM transactions AS bev
    WHERE bev.level = jac.level
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM orders AS fal
    WHERE fal.id = nad.id
);


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

SELECT name FROM managers AS hac
WHERE code IN (
    SELECT code FROM employees AS vmob
    WHERE vmob.code = hac.code
);


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

SELECT name FROM projects AS uliv
WHERE amount > (
    SELECT MIN(salary) FROM items AS dov
    WHERE dov.level = uliv.level
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM requests AS fal
    WHERE fal.level = dov.level
);


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM transactions AS xnob
    WHERE xnob.code = uliv.code
);


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

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


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS jac
    WHERE jac.type = okiv.type
);


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

SELECT code FROM staff AS xnob
WHERE status IN (
    SELECT status FROM accounts AS okiv
    WHERE okiv.code = xnob.code
);


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

SELECT name FROM departments AS dov
WHERE value > (
    SELECT COUNT(amount) FROM transactions AS agov
    WHERE agov.type = dov.type
);


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

SELECT code FROM sales AS cif
WHERE status IN (
    SELECT status FROM departments AS uliv
    WHERE uliv.status = cif.status
);


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

SELECT id FROM requests AS ejof
WHERE type IN (
    SELECT type FROM employees AS gev
    WHERE gev.code = ejof.code
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM branches AS jac
    WHERE jac.type = lex.type
);


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

SELECT value FROM products AS nad
WHERE value > (
    SELECT AVG(salary) FROM schedules AS jac
    WHERE jac.id = nad.id
);


Prompt:
Schema:
  categories (alias: egiv)(id, code, amount, status)
  requests(date, amount, type, status)
Task: Find id from categories where amount exceeds the average amount from requests for the same type.
SQL:

SELECT id FROM categories AS egiv
WHERE amount > (
    SELECT AVG(amount) FROM requests AS jac
    WHERE jac.type = egiv.type
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.id = xnob.id
);


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

SELECT value FROM tasks AS znob
WHERE amount > (
    SELECT MIN(salary) FROM orders AS cif
    WHERE cif.level = znob.level
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM tasks AS nad
    WHERE nad.id = uliv.id
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS dov
    WHERE dov.level = vnob.level
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM accounts AS nad
    WHERE nad.level = ejof.level
);


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

SELECT value FROM branches AS agov
WHERE status IN (
    SELECT status FROM employees AS bev
    WHERE bev.type = agov.type
);


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM customers AS znob
    WHERE znob.type = okiv.type
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS kab
    WHERE kab.id = vnob.id
);


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

SELECT value FROM accounts AS jac
WHERE salary > (
    SELECT AVG(salary) FROM products AS fal
    WHERE fal.code = jac.code
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM schedules AS okiv
    WHERE okiv.id = ikob.id
);


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

SELECT amount FROM sales AS cif
WHERE value > (
    SELECT COUNT(salary) FROM transactions AS ejof
    WHERE ejof.code = cif.code
);


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

SELECT salary FROM orders AS kab
WHERE salary > (
    SELECT MIN(amount) FROM requests AS xnob
    WHERE xnob.code = kab.code
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM tasks AS jac
    WHERE jac.level = hac.level
);


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

SELECT name FROM requests AS ejof
WHERE code IN (
    SELECT code FROM items AS lex
    WHERE lex.id = ejof.id
);


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

SELECT salary FROM schedules AS vmob
WHERE value > (
    SELECT COUNT(value) FROM staff AS jac
    WHERE jac.id = vmob.id
);


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM branches AS znob
    WHERE znob.id = lex.id
);


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

SELECT name FROM sales AS cif
WHERE amount > (
    SELECT SUM(value) FROM orders AS dov
    WHERE dov.id = cif.id
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.level = nad.level
);


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

SELECT name FROM transactions AS gev
WHERE amount > (
    SELECT COUNT(amount) FROM branches AS okiv
    WHERE okiv.status = gev.status
);


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM regions AS znob
    WHERE znob.status = ejof.status
);


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT MAX(amount) FROM regions AS fal
    WHERE fal.type = znob.type
);


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM transactions AS cif
    WHERE cif.level = agov.level
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM items AS okiv
    WHERE okiv.type = kab.type
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.id = lex.id
);


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

SELECT value FROM regions AS okiv
WHERE salary > (
    SELECT MIN(value) FROM invoices AS dov
    WHERE dov.level = okiv.level
);


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

SELECT name FROM categories AS egiv
WHERE amount > (
    SELECT AVG(amount) FROM tasks AS cif
    WHERE cif.id = egiv.id
);


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

SELECT id FROM categories AS egiv
WHERE amount > (
    SELECT MAX(value) FROM schedules AS hac
    WHERE hac.status = egiv.status
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM staff AS kab
    WHERE kab.level = cif.level
);


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

SELECT id FROM sales AS cif
WHERE code IN (
    SELECT code FROM shipments AS hac
    WHERE hac.type = cif.type
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.id = uliv.id
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM regions AS bev
    WHERE bev.status = egiv.status
);


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

SELECT id FROM requests AS ejof
WHERE level IN (
    SELECT level FROM branches AS vmob
    WHERE vmob.id = ejof.id
);


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

SELECT name FROM items AS ikob
WHERE amount > (
    SELECT MIN(salary) FROM customers AS agov
    WHERE agov.level = ikob.level
);


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

SELECT amount FROM projects AS uliv
WHERE id IN (
    SELECT id FROM products AS cif
    WHERE cif.status = uliv.status
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM managers AS ikob
    WHERE ikob.code = vmob.code
);


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

SELECT name FROM transactions AS gev
WHERE level IN (
    SELECT level FROM staff AS vnob
    WHERE vnob.level = gev.level
);


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

SELECT id FROM orders AS kab
WHERE status IN (
    SELECT status FROM products AS znob
    WHERE znob.code = kab.code
);


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

SELECT id FROM managers AS hac
WHERE code IN (
    SELECT code FROM projects AS lex
    WHERE lex.id = hac.id
);


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

SELECT value FROM orders AS kab
WHERE value > (
    SELECT MIN(amount) FROM products AS ejof
    WHERE ejof.status = kab.status
);


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

SELECT amount FROM employees AS bev
WHERE value > (
    SELECT MAX(amount) FROM invoices AS xnob
    WHERE xnob.level = bev.level
);


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

SELECT name FROM products AS nad
WHERE level IN (
    SELECT level FROM accounts AS cif
    WHERE cif.type = nad.type
);


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

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


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

SELECT amount FROM staff AS xnob
WHERE value > (
    SELECT COUNT(value) FROM categories AS okiv
    WHERE okiv.id = xnob.id
);


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

SELECT code FROM accounts AS jac
WHERE code IN (
    SELECT code FROM shipments AS ejof
    WHERE ejof.type = jac.type
);


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

SELECT code FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM accounts AS dov
    WHERE dov.id = vmob.id
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM shipments AS ikob
    WHERE ikob.id = lex.id
);


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

SELECT value FROM regions AS okiv
WHERE value > (
    SELECT MAX(amount) FROM employees AS egiv
    WHERE egiv.id = okiv.id
);


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

SELECT name FROM managers AS hac
WHERE value > (
    SELECT SUM(value) FROM departments AS egiv
    WHERE egiv.code = hac.code
);


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

SELECT code FROM employees AS bev
WHERE value > (
    SELECT MAX(amount) FROM sales AS vmob
    WHERE vmob.level = bev.level
);


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

SELECT salary FROM transactions AS gev
WHERE type IN (
    SELECT type FROM shipments AS fal
    WHERE fal.level = gev.level
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM branches AS fal
    WHERE fal.code = lex.code
);


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

SELECT value FROM categories AS egiv
WHERE code IN (
    SELECT code FROM projects AS lex
    WHERE lex.type = egiv.type
);


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

SELECT salary FROM staff AS xnob
WHERE type IN (
    SELECT type FROM schedules AS ikob
    WHERE ikob.code = xnob.code
);


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

SELECT value FROM customers AS lex
WHERE value > (
    SELECT MAX(amount) FROM orders AS jac
    WHERE jac.id = lex.id
);


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

SELECT name FROM managers AS hac
WHERE id IN (
    SELECT id FROM schedules AS jac
    WHERE jac.level = hac.level
);


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

SELECT amount FROM products AS nad
WHERE code IN (
    SELECT code FROM managers AS agov
    WHERE agov.level = nad.level
);


Prompt:
Schema:
  sales (alias: cif)(amount, salary, status, type)
  departments(id, date, value, salary)
Task: Find salary from sales where amount exceeds the maximum value from departments for the same id.
SQL:

SELECT salary FROM sales AS cif
WHERE amount > (
    SELECT MAX(value) FROM departments AS bev
    WHERE bev.id = cif.id
);


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

SELECT value FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM branches AS egiv
    WHERE egiv.level = vnob.level
);