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

SELECT id FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM branches AS bev
    WHERE bev.type = vnob.type
);


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

SELECT amount FROM accounts AS jac
WHERE salary > (
    SELECT COUNT(value) FROM tasks AS bev
    WHERE bev.code = jac.code
);


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

SELECT name FROM invoices AS fal
WHERE level IN (
    SELECT level FROM regions AS ejof
    WHERE ejof.level = fal.level
);


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

SELECT amount FROM customers AS lex
WHERE value > (
    SELECT MIN(amount) FROM categories AS jac
    WHERE jac.type = lex.type
);


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

SELECT name FROM projects AS uliv
WHERE amount > (
    SELECT AVG(value) FROM sales AS dov
    WHERE dov.level = uliv.level
);


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

SELECT salary FROM requests AS ejof
WHERE type IN (
    SELECT type FROM sales AS dov
    WHERE dov.level = ejof.level
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM regions AS nad
    WHERE nad.level = fal.level
);


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

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


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

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


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

SELECT value FROM regions AS okiv
WHERE value > (
    SELECT AVG(value) FROM customers AS kab
    WHERE kab.id = okiv.id
);


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

SELECT amount FROM transactions AS gev
WHERE status IN (
    SELECT status FROM sales AS ikob
    WHERE ikob.status = gev.status
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.level = vnob.level
);


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

SELECT id FROM managers AS hac
WHERE salary > (
    SELECT MIN(value) FROM transactions AS kab
    WHERE kab.id = hac.id
);


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

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


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

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


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

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


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

SELECT value FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM tasks AS gev
    WHERE gev.code = vmob.code
);


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

SELECT value FROM invoices AS fal
WHERE salary > (
    SELECT MIN(amount) FROM orders AS jac
    WHERE jac.code = fal.code
);


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

SELECT salary FROM items AS ikob
WHERE amount > (
    SELECT SUM(value) FROM staff AS znob
    WHERE znob.status = ikob.status
);


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

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


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

SELECT value FROM projects AS uliv
WHERE amount > (
    SELECT AVG(salary) FROM customers AS cif
    WHERE cif.status = uliv.status
);


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

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


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM shipments AS dov
    WHERE dov.status = cif.status
);


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

SELECT value FROM products AS nad
WHERE code IN (
    SELECT code FROM requests AS gev
    WHERE gev.type = nad.type
);


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

SELECT name FROM branches AS agov
WHERE id IN (
    SELECT id FROM orders AS nad
    WHERE nad.status = agov.status
);


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

SELECT id FROM managers AS hac
WHERE value > (
    SELECT SUM(amount) FROM items AS kab
    WHERE kab.level = hac.level
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM tasks AS vmob
    WHERE vmob.level = dov.level
);


Prompt:
Schema:
  categories (alias: egiv)(id, value, amount, status)
  departments(salary, amount, code, value)
Task: Find value from categories where a matching record exists in departments with the same status.
SQL:

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


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

SELECT amount FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM categories AS hac
    WHERE hac.type = lex.type
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM sales AS dov
    WHERE dov.id = ejof.id
);


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

SELECT code FROM orders AS kab
WHERE value > (
    SELECT MIN(salary) FROM branches AS agov
    WHERE agov.id = kab.id
);


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM customers AS hac
    WHERE hac.level = vmob.level
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM sales AS znob
    WHERE znob.status = gev.status
);


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

SELECT name FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM projects AS gev
    WHERE gev.status = vnob.status
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM departments AS cif
    WHERE cif.type = xnob.type
);


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

SELECT amount FROM regions AS okiv
WHERE amount > (
    SELECT SUM(value) FROM categories AS uliv
    WHERE uliv.level = okiv.level
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM shipments AS okiv
    WHERE okiv.id = fal.id
);


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

SELECT name FROM items AS ikob
WHERE salary > (
    SELECT MAX(salary) FROM departments AS znob
    WHERE znob.type = ikob.type
);


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

SELECT id FROM regions AS okiv
WHERE type IN (
    SELECT type FROM staff AS kab
    WHERE kab.level = okiv.level
);


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

SELECT salary FROM employees AS bev
WHERE amount > (
    SELECT AVG(amount) FROM projects AS dov
    WHERE dov.level = bev.level
);


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.code = egiv.code
);


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

SELECT salary FROM staff AS xnob
WHERE status IN (
    SELECT status FROM regions AS nad
    WHERE nad.level = xnob.level
);


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

SELECT salary FROM requests AS ejof
WHERE amount > (
    SELECT SUM(value) FROM categories AS ikob
    WHERE ikob.level = ejof.level
);


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

SELECT id FROM staff AS xnob
WHERE salary > (
    SELECT COUNT(value) FROM items AS dov
    WHERE dov.id = xnob.id
);


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

SELECT amount FROM invoices AS fal
WHERE code IN (
    SELECT code FROM transactions AS jac
    WHERE jac.level = fal.level
);


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

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


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

SELECT salary FROM customers AS lex
WHERE code IN (
    SELECT code FROM tasks AS kab
    WHERE kab.code = lex.code
);


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM accounts AS kab
    WHERE kab.type = ejof.type
);


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

SELECT value FROM tasks AS znob
WHERE level IN (
    SELECT level FROM transactions AS bev
    WHERE bev.id = znob.id
);


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

SELECT id FROM accounts AS jac
WHERE id IN (
    SELECT id FROM regions AS uliv
    WHERE uliv.status = jac.status
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT COUNT(amount) FROM schedules AS cif
    WHERE cif.level = okiv.level
);


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

SELECT id FROM managers AS hac
WHERE salary > (
    SELECT AVG(amount) FROM products AS egiv
    WHERE egiv.status = hac.status
);


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

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


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

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


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT MIN(salary) FROM sales AS xnob
    WHERE xnob.status = vmob.status
);


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

SELECT code FROM items AS ikob
WHERE type IN (
    SELECT type FROM customers AS fal
    WHERE fal.level = ikob.level
);


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

SELECT amount FROM tasks AS znob
WHERE amount > (
    SELECT MIN(amount) FROM staff AS lex
    WHERE lex.type = znob.type
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM staff AS egiv
    WHERE egiv.code = ikob.code
);


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

SELECT name FROM requests AS ejof
WHERE amount > (
    SELECT MIN(salary) FROM regions AS egiv
    WHERE egiv.level = ejof.level
);


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

SELECT amount FROM branches AS agov
WHERE id IN (
    SELECT id FROM categories AS znob
    WHERE znob.code = agov.code
);


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

SELECT name FROM accounts AS jac
WHERE value > (
    SELECT SUM(amount) FROM sales AS cif
    WHERE cif.code = jac.code
);


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

SELECT id FROM products AS nad
WHERE salary > (
    SELECT COUNT(salary) FROM sales AS fal
    WHERE fal.id = nad.id
);


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

SELECT salary FROM orders AS kab
WHERE code IN (
    SELECT code FROM requests AS hac
    WHERE hac.type = kab.type
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM staff AS okiv
    WHERE okiv.code = uliv.code
);


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

SELECT value FROM categories AS egiv
WHERE id IN (
    SELECT id FROM departments AS kab
    WHERE kab.type = egiv.type
);


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

SELECT salary FROM branches AS agov
WHERE code IN (
    SELECT code FROM categories AS vnob
    WHERE vnob.code = agov.code
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT MIN(value) FROM customers AS jac
    WHERE jac.id = okiv.id
);


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

SELECT id FROM requests AS ejof
WHERE code IN (
    SELECT code FROM sales AS egiv
    WHERE egiv.id = ejof.id
);


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

SELECT code FROM items AS ikob
WHERE amount > (
    SELECT AVG(salary) FROM invoices AS vmob
    WHERE vmob.status = ikob.status
);


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

SELECT salary FROM customers AS lex
WHERE level IN (
    SELECT level FROM products AS agov
    WHERE agov.level = lex.level
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM employees AS cif
    WHERE cif.id = fal.id
);


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

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


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

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


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

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


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM schedules AS nad
    WHERE nad.level = okiv.level
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM departments AS okiv
    WHERE okiv.level = bev.level
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS egiv
    WHERE egiv.type = xnob.type
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT MIN(salary) FROM regions AS okiv
    WHERE okiv.code = jac.code
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM transactions AS bev
    WHERE bev.level = fal.level
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM categories AS vmob
    WHERE vmob.level = dov.level
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT COUNT(value) FROM tasks AS znob
    WHERE znob.status = hac.status
);


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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM departments AS okiv
    WHERE okiv.id = jac.id
);


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

SELECT value FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(salary) FROM products AS vmob
    WHERE vmob.id = vnob.id
);


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

SELECT name FROM tasks AS znob
WHERE id IN (
    SELECT id FROM requests AS vnob
    WHERE vnob.level = znob.level
);


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

SELECT salary FROM employees AS bev
WHERE amount > (
    SELECT MIN(value) FROM orders AS ejof
    WHERE ejof.type = bev.type
);


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

SELECT code FROM staff AS xnob
WHERE value > (
    SELECT MIN(salary) FROM managers AS lex
    WHERE lex.code = xnob.code
);


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

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


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

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


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

SELECT name FROM requests AS ejof
WHERE code IN (
    SELECT code FROM products AS ikob
    WHERE ikob.type = ejof.type
);


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

SELECT salary FROM branches AS agov
WHERE code IN (
    SELECT code FROM schedules AS lex
    WHERE lex.level = agov.level
);


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

SELECT name FROM products AS nad
WHERE level IN (
    SELECT level FROM invoices AS okiv
    WHERE okiv.code = nad.code
);


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

SELECT id FROM departments AS dov
WHERE code IN (
    SELECT code FROM schedules AS ejof
    WHERE ejof.type = dov.type
);


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

SELECT value FROM invoices AS fal
WHERE status IN (
    SELECT status FROM accounts AS kab
    WHERE kab.id = fal.id
);


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

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


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

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


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM managers AS egiv
    WHERE egiv.status = vnob.status
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM categories AS cif
    WHERE cif.id = vnob.id
);


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

SELECT amount FROM projects AS uliv
WHERE level IN (
    SELECT level FROM regions AS ejof
    WHERE ejof.type = uliv.type
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM products AS znob
    WHERE znob.id = vnob.id
);


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

SELECT name FROM products AS nad
WHERE status IN (
    SELECT status FROM projects AS hac
    WHERE hac.code = nad.code
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.id = bev.id
);


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

SELECT amount FROM regions AS okiv
WHERE level IN (
    SELECT level FROM schedules AS egiv
    WHERE egiv.level = okiv.level
);


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

SELECT id FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM regions AS ejof
    WHERE ejof.type = znob.type
);


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

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


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

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


Prompt:
Schema:
  projects (alias: uliv)(date, amount, status, level)
  items(amount, value, status, type)
Task: Find code from projects where amount exceeds the count of amount from items for the same type.
SQL:

SELECT code FROM projects AS uliv
WHERE amount > (
    SELECT COUNT(amount) FROM items AS ejof
    WHERE ejof.type = uliv.type
);


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

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


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

SELECT value FROM sales AS cif
WHERE amount > (
    SELECT MAX(value) FROM staff AS ejof
    WHERE ejof.level = cif.level
);


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

SELECT id FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM regions AS fal
    WHERE fal.id = vmob.id
);


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

SELECT value FROM branches AS agov
WHERE code IN (
    SELECT code FROM departments AS lex
    WHERE lex.id = agov.id
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM tasks AS bev
    WHERE bev.level = agov.level
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM employees AS xnob
    WHERE xnob.code = egiv.code
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM departments AS xnob
    WHERE xnob.type = cif.type
);


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

SELECT amount FROM customers AS lex
WHERE code IN (
    SELECT code FROM employees AS gev
    WHERE gev.status = lex.status
);


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

SELECT id FROM items AS ikob
WHERE amount > (
    SELECT AVG(amount) FROM schedules AS kab
    WHERE kab.status = ikob.status
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS kab
    WHERE kab.id = xnob.id
);


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM transactions AS agov
    WHERE agov.status = bev.status
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT AVG(amount) FROM shipments AS gev
    WHERE gev.id = kab.id
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM managers AS agov
    WHERE agov.id = cif.id
);


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

SELECT code FROM categories AS egiv
WHERE type IN (
    SELECT type FROM products AS lex
    WHERE lex.status = egiv.status
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.code = jac.code
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM orders AS ejof
    WHERE ejof.level = vnob.level
);


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

SELECT code FROM sales AS cif
WHERE id IN (
    SELECT id FROM regions AS kab
    WHERE kab.id = cif.id
);


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

SELECT code FROM employees AS bev
WHERE amount > (
    SELECT MIN(salary) FROM tasks AS gev
    WHERE gev.status = bev.status
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM customers AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT value FROM managers AS hac
WHERE amount > (
    SELECT MAX(value) FROM departments AS vnob
    WHERE vnob.status = hac.status
);


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

SELECT salary FROM categories AS egiv
WHERE value > (
    SELECT SUM(salary) FROM staff AS znob
    WHERE znob.level = egiv.level
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM transactions AS jac
    WHERE jac.type = uliv.type
);


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

SELECT name FROM tasks AS znob
WHERE code IN (
    SELECT code FROM products AS vmob
    WHERE vmob.type = znob.type
);


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

SELECT id FROM products AS nad
WHERE amount > (
    SELECT MIN(amount) FROM shipments AS bev
    WHERE bev.level = nad.level
);


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

SELECT code FROM products AS nad
WHERE code IN (
    SELECT code FROM departments AS cif
    WHERE cif.level = nad.level
);


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

SELECT amount FROM projects AS uliv
WHERE status IN (
    SELECT status FROM departments AS hac
    WHERE hac.code = uliv.code
);


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

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


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM shipments AS kab
    WHERE kab.type = vmob.type
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM shipments AS lex
    WHERE lex.id = gev.id
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM branches AS znob
    WHERE znob.status = cif.status
);


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.code = ikob.code
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS hac
    WHERE hac.id = gev.id
);


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

SELECT id FROM transactions AS gev
WHERE value > (
    SELECT MIN(value) FROM departments AS vmob
    WHERE vmob.id = gev.id
);


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

SELECT value FROM products AS nad
WHERE amount > (
    SELECT AVG(amount) FROM managers AS ejof
    WHERE ejof.id = nad.id
);


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

SELECT value FROM requests AS ejof
WHERE status IN (
    SELECT status FROM invoices AS nad
    WHERE nad.type = ejof.type
);


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

SELECT name FROM customers AS lex
WHERE value > (
    SELECT AVG(amount) FROM employees AS bev
    WHERE bev.id = lex.id
);


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

SELECT amount FROM requests AS ejof
WHERE status IN (
    SELECT status FROM invoices AS znob
    WHERE znob.id = ejof.id
);


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM employees AS jac
    WHERE jac.id = agov.id
);


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

SELECT salary FROM employees AS bev
WHERE type IN (
    SELECT type FROM schedules AS cif
    WHERE cif.type = bev.type
);


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT SUM(value) FROM departments AS ikob
    WHERE ikob.type = agov.type
);


Prompt:
Schema:
  categories (alias: egiv)(name, type, date, level)
  branches(date, code, name, id)
Task: Retrieve code from categories with value above the MIN(value) of branches rows sharing the same level.
SQL:

SELECT code FROM categories AS egiv
WHERE value > (
    SELECT MIN(value) FROM branches AS vmob
    WHERE vmob.level = egiv.level
);


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

SELECT value FROM products AS nad
WHERE salary > (
    SELECT AVG(value) FROM regions AS dov
    WHERE dov.status = nad.status
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM departments AS gev
    WHERE gev.type = lex.type
);


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

SELECT code FROM products AS nad
WHERE level IN (
    SELECT level FROM branches AS jac
    WHERE jac.status = nad.status
);


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

SELECT id FROM invoices AS fal
WHERE amount > (
    SELECT MIN(amount) FROM accounts AS kab
    WHERE kab.status = fal.status
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM employees AS fal
    WHERE fal.id = gev.id
);


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

SELECT id FROM invoices AS fal
WHERE status IN (
    SELECT status FROM branches AS xnob
    WHERE xnob.status = fal.status
);


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

SELECT amount FROM categories AS egiv
WHERE salary > (
    SELECT COUNT(amount) FROM departments AS ikob
    WHERE ikob.code = egiv.code
);


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

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


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

SELECT amount FROM accounts AS jac
WHERE amount > (
    SELECT SUM(value) FROM requests AS nad
    WHERE nad.id = jac.id
);


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

SELECT name FROM staff AS xnob
WHERE amount > (
    SELECT AVG(value) FROM accounts AS znob
    WHERE znob.id = xnob.id
);


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

SELECT salary FROM items AS ikob
WHERE level IN (
    SELECT level FROM staff AS agov
    WHERE agov.id = ikob.id
);


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

SELECT code FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(salary) FROM sales AS cif
    WHERE cif.code = znob.code
);


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

SELECT id FROM tasks AS znob
WHERE status IN (
    SELECT status FROM accounts AS uliv
    WHERE uliv.status = znob.status
);


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

SELECT value FROM projects AS uliv
WHERE level IN (
    SELECT level FROM products AS bev
    WHERE bev.status = uliv.status
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.status = cif.status
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM regions AS nad
    WHERE nad.type = dov.type
);


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

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


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

SELECT value FROM transactions AS gev
WHERE value > (
    SELECT COUNT(salary) FROM accounts AS vmob
    WHERE vmob.type = gev.type
);


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

SELECT id FROM transactions AS gev
WHERE status IN (
    SELECT status FROM invoices AS ikob
    WHERE ikob.status = gev.status
);


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

SELECT amount FROM invoices AS fal
WHERE level IN (
    SELECT level FROM requests AS znob
    WHERE znob.status = fal.status
);


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

SELECT name FROM staff AS xnob
WHERE level IN (
    SELECT level FROM tasks AS hac
    WHERE hac.id = xnob.id
);


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

SELECT amount FROM customers AS lex
WHERE salary > (
    SELECT AVG(salary) FROM accounts AS vnob
    WHERE vnob.id = lex.id
);


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

SELECT value FROM sales AS cif
WHERE id IN (
    SELECT id FROM branches AS jac
    WHERE jac.status = cif.status
);


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

SELECT amount FROM employees AS bev
WHERE code IN (
    SELECT code FROM regions AS nad
    WHERE nad.level = bev.level
);


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

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


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

SELECT value FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM shipments AS jac
    WHERE jac.level = vmob.level
);


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

SELECT name FROM departments AS dov
WHERE type IN (
    SELECT type FROM requests AS bev
    WHERE bev.status = dov.status
);


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

SELECT value FROM requests AS ejof
WHERE amount > (
    SELECT SUM(salary) FROM branches AS znob
    WHERE znob.type = ejof.type
);


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

SELECT id FROM employees AS bev
WHERE code IN (
    SELECT code FROM projects AS fal
    WHERE fal.id = bev.id
);


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

SELECT value FROM employees AS bev
WHERE type IN (
    SELECT type FROM accounts AS dov
    WHERE dov.type = bev.type
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM sales AS vmob
    WHERE vmob.level = gev.level
);


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

SELECT salary FROM projects AS uliv
WHERE code IN (
    SELECT code FROM requests AS gev
    WHERE gev.level = uliv.level
);


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

SELECT salary FROM categories AS egiv
WHERE type IN (
    SELECT type FROM orders AS fal
    WHERE fal.status = egiv.status
);


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

SELECT code FROM tasks AS znob
WHERE level IN (
    SELECT level FROM schedules AS bev
    WHERE bev.code = znob.code
);


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

SELECT id FROM branches AS agov
WHERE id IN (
    SELECT id FROM products AS fal
    WHERE fal.id = agov.id
);


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

SELECT amount FROM employees AS bev
WHERE value > (
    SELECT SUM(amount) FROM transactions AS vnob
    WHERE vnob.id = bev.id
);


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

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


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

SELECT code FROM customers AS lex
WHERE amount > (
    SELECT COUNT(amount) FROM managers AS dov
    WHERE dov.status = lex.status
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM categories AS kab
    WHERE kab.status = lex.status
);


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

SELECT name FROM tasks AS znob
WHERE value > (
    SELECT MAX(value) FROM orders AS lex
    WHERE lex.type = znob.type
);


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

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


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM invoices AS xnob
    WHERE xnob.code = cif.code
);


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

SELECT salary FROM sales AS cif
WHERE value > (
    SELECT SUM(salary) FROM managers AS egiv
    WHERE egiv.type = cif.type
);


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

SELECT code FROM employees AS bev
WHERE value > (
    SELECT MAX(amount) FROM categories AS okiv
    WHERE okiv.type = bev.type
);


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

SELECT name FROM branches AS agov
WHERE level IN (
    SELECT level FROM invoices AS gev
    WHERE gev.status = agov.status
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE salary > (
    SELECT MIN(salary) FROM shipments AS vmob
    WHERE vmob.status = xnob.status
);


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

SELECT value FROM shipments AS vnob
WHERE salary > (
    SELECT MIN(amount) FROM managers AS znob
    WHERE znob.type = vnob.type
);


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM orders AS bev
    WHERE bev.status = ejof.status
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM sales AS vmob
    WHERE vmob.id = uliv.id
);


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

SELECT value FROM transactions AS gev
WHERE type IN (
    SELECT type FROM schedules AS vnob
    WHERE vnob.status = gev.status
);


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

SELECT value FROM accounts AS jac
WHERE value > (
    SELECT MAX(value) FROM requests AS kab
    WHERE kab.level = jac.level
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM requests AS xnob
    WHERE xnob.code = dov.code
);


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

SELECT id FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM managers AS uliv
    WHERE uliv.level = nad.level
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM invoices AS nad
    WHERE nad.id = kab.id
);


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

SELECT code FROM tasks AS znob
WHERE salary > (
    SELECT MAX(salary) FROM projects AS cif
    WHERE cif.code = znob.code
);


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

SELECT name FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM managers AS gev
    WHERE gev.code = vnob.code
);


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

SELECT amount FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(salary) FROM staff AS xnob
    WHERE xnob.level = znob.level
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.id = ikob.id
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM products AS agov
    WHERE agov.code = egiv.code
);


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

SELECT id FROM shipments AS vnob
WHERE salary > (
    SELECT MAX(salary) FROM employees AS xnob
    WHERE xnob.status = vnob.status
);


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

SELECT amount FROM customers AS lex
WHERE status IN (
    SELECT status FROM tasks AS cif
    WHERE cif.id = lex.id
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM requests AS cif
    WHERE cif.code = vnob.code
);


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

SELECT value FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM items AS jac
    WHERE jac.id = egiv.id
);


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

SELECT value FROM customers AS lex
WHERE type IN (
    SELECT type FROM projects AS znob
    WHERE znob.type = lex.type
);


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

SELECT code FROM items AS ikob
WHERE level IN (
    SELECT level FROM invoices AS dov
    WHERE dov.code = ikob.code
);


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

SELECT amount FROM branches AS agov
WHERE value > (
    SELECT SUM(salary) FROM staff AS cif
    WHERE cif.type = agov.type
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM projects AS ejof
    WHERE ejof.level = jac.level
);


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM sales AS egiv
    WHERE egiv.status = lex.status
);


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

SELECT code FROM tasks AS znob
WHERE value > (
    SELECT SUM(salary) FROM products AS vmob
    WHERE vmob.code = znob.code
);


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

SELECT salary FROM staff AS xnob
WHERE value > (
    SELECT MAX(salary) FROM schedules AS bev
    WHERE bev.id = xnob.id
);


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

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


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

SELECT value FROM customers AS lex
WHERE salary > (
    SELECT SUM(amount) FROM transactions AS vmob
    WHERE vmob.status = lex.status
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM products AS egiv
    WHERE egiv.type = uliv.type
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM customers AS hac
    WHERE hac.code = ejof.code
);


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

SELECT value FROM employees AS bev
WHERE code IN (
    SELECT code FROM schedules AS uliv
    WHERE uliv.type = bev.type
);


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

SELECT value FROM managers AS hac
WHERE salary > (
    SELECT SUM(value) FROM branches AS egiv
    WHERE egiv.id = hac.id
);


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

SELECT salary FROM invoices AS fal
WHERE value > (
    SELECT MIN(salary) FROM accounts AS okiv
    WHERE okiv.id = fal.id
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.type = ejof.type
);


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

SELECT value FROM accounts AS jac
WHERE value > (
    SELECT SUM(salary) FROM tasks AS ejof
    WHERE ejof.id = jac.id
);


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

SELECT code FROM accounts AS jac
WHERE code IN (
    SELECT code FROM products AS ikob
    WHERE ikob.code = jac.code
);


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

SELECT name FROM managers AS hac
WHERE id IN (
    SELECT id FROM transactions AS nad
    WHERE nad.type = hac.type
);


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

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


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

SELECT value FROM items AS ikob
WHERE amount > (
    SELECT MIN(amount) FROM customers AS uliv
    WHERE uliv.status = ikob.status
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM branches AS znob
    WHERE znob.type = fal.type
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM schedules AS xnob
    WHERE xnob.id = znob.id
);


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

SELECT id FROM regions AS okiv
WHERE amount > (
    SELECT COUNT(value) FROM managers AS nad
    WHERE nad.type = okiv.type
);


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

SELECT salary FROM projects AS uliv
WHERE code IN (
    SELECT code FROM regions AS znob
    WHERE znob.code = uliv.code
);


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

SELECT salary FROM managers AS hac
WHERE amount > (
    SELECT MIN(amount) FROM branches AS znob
    WHERE znob.id = hac.id
);


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

SELECT value FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM managers AS lex
    WHERE lex.code = fal.code
);


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

SELECT id FROM categories AS egiv
WHERE status IN (
    SELECT status FROM employees AS okiv
    WHERE okiv.id = egiv.id
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM accounts AS vnob
    WHERE vnob.status = nad.status
);


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM customers AS jac
    WHERE jac.id = egiv.id
);


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

SELECT name FROM regions AS okiv
WHERE status IN (
    SELECT status FROM schedules AS vnob
    WHERE vnob.code = okiv.code
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM branches AS bev
    WHERE bev.level = ejof.level
);


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

SELECT amount FROM departments AS dov
WHERE status IN (
    SELECT status FROM accounts AS ikob
    WHERE ikob.status = dov.status
);


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

SELECT value FROM branches AS agov
WHERE level IN (
    SELECT level FROM projects AS hac
    WHERE hac.type = agov.type
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM staff AS ikob
    WHERE ikob.status = agov.status
);


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

SELECT amount FROM staff AS xnob
WHERE value > (
    SELECT COUNT(value) FROM schedules AS egiv
    WHERE egiv.level = xnob.level
);


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

SELECT id FROM orders AS kab
WHERE value > (
    SELECT MAX(amount) FROM managers AS nad
    WHERE nad.id = kab.id
);


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

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


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

SELECT name FROM items AS ikob
WHERE id IN (
    SELECT id FROM transactions AS cif
    WHERE cif.id = ikob.id
);


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

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


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM items AS vmob
    WHERE vmob.code = ejof.code
);


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

SELECT id FROM employees AS bev
WHERE value > (
    SELECT MIN(amount) FROM items AS gev
    WHERE gev.type = bev.type
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM projects AS lex
    WHERE lex.type = fal.type
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM sales AS egiv
    WHERE egiv.id = jac.id
);


Prompt:
Schema:
  invoices (alias: fal)(date, id, type, salary)
  schedules(type, date, salary, name)
Task: Find salary from invoices where salary exceeds the minimum salary from schedules for the same level.
SQL:

SELECT salary FROM invoices AS fal
WHERE salary > (
    SELECT MIN(salary) FROM schedules AS lex
    WHERE lex.level = fal.level
);


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

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


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

SELECT id FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM customers AS hac
    WHERE hac.id = jac.id
);


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

SELECT name FROM transactions AS gev
WHERE salary > (
    SELECT SUM(amount) FROM tasks AS uliv
    WHERE uliv.id = gev.id
);


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

SELECT amount FROM projects AS uliv
WHERE id IN (
    SELECT id FROM schedules AS gev
    WHERE gev.type = uliv.type
);


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM customers AS agov
    WHERE agov.status = egiv.status
);


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

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


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

SELECT value FROM projects AS uliv
WHERE id IN (
    SELECT id FROM departments AS znob
    WHERE znob.code = uliv.code
);


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

SELECT name FROM projects AS uliv
WHERE type IN (
    SELECT type FROM items AS kab
    WHERE kab.id = uliv.id
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM projects AS bev
    WHERE bev.id = xnob.id
);


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

SELECT value FROM requests AS ejof
WHERE code IN (
    SELECT code FROM tasks AS ikob
    WHERE ikob.code = ejof.code
);


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

SELECT code FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM sales AS agov
    WHERE agov.status = dov.status
);


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

SELECT id FROM requests AS ejof
WHERE value > (
    SELECT MAX(amount) FROM regions AS vmob
    WHERE vmob.status = ejof.status
);


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM tasks AS ikob
    WHERE ikob.level = lex.level
);


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

SELECT id FROM invoices AS fal
WHERE amount > (
    SELECT MIN(value) FROM accounts AS znob
    WHERE znob.id = fal.id
);


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

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


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

SELECT salary FROM schedules AS vmob
WHERE value > (
    SELECT COUNT(salary) FROM orders AS bev
    WHERE bev.type = vmob.type
);


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

SELECT code FROM sales AS cif
WHERE type IN (
    SELECT type FROM managers AS bev
    WHERE bev.status = cif.status
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM orders AS ikob
    WHERE ikob.status = gev.status
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.status = fal.status
);


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

SELECT id FROM customers AS lex
WHERE code IN (
    SELECT code FROM managers AS cif
    WHERE cif.id = lex.id
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM items AS hac
    WHERE hac.level = okiv.level
);


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM categories AS ejof
    WHERE ejof.status = znob.status
);


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

SELECT value FROM departments AS dov
WHERE level IN (
    SELECT level FROM categories AS cif
    WHERE cif.status = dov.status
);


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

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(value) FROM accounts AS bev
    WHERE bev.code = vmob.code
);


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

SELECT id FROM accounts AS jac
WHERE amount > (
    SELECT MAX(salary) FROM items AS hac
    WHERE hac.status = jac.status
);


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

SELECT code FROM employees AS bev
WHERE salary > (
    SELECT AVG(value) FROM accounts AS hac
    WHERE hac.id = bev.id
);


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

SELECT id FROM branches AS agov
WHERE status IN (
    SELECT status FROM accounts AS ikob
    WHERE ikob.status = agov.status
);


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

SELECT salary FROM orders AS kab
WHERE id IN (
    SELECT id FROM tasks AS agov
    WHERE agov.id = kab.id
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM departments AS znob
    WHERE znob.status = cif.status
);


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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT MIN(amount) FROM orders AS gev
    WHERE gev.status = fal.status
);


Prompt:
Schema:
  requests (alias: ejof)(type, status, level, value)
  departments(level, amount, status, value)
Task: Retrieve value from requests with amount above the COUNT(salary) of departments rows sharing the same type.
SQL:

SELECT value FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(salary) FROM departments AS vmob
    WHERE vmob.type = ejof.type
);


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

SELECT id FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM branches AS jac
    WHERE jac.code = okiv.code
);


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

SELECT value FROM products AS nad
WHERE code IN (
    SELECT code FROM regions AS znob
    WHERE znob.code = nad.code
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM items AS fal
    WHERE fal.level = vmob.level
);


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

SELECT value FROM regions AS okiv
WHERE level IN (
    SELECT level FROM departments AS nad
    WHERE nad.type = okiv.type
);


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

SELECT code FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM orders AS gev
    WHERE gev.code = agov.code
);


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

SELECT amount FROM products AS nad
WHERE type IN (
    SELECT type FROM shipments AS vnob
    WHERE vnob.level = nad.level
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM branches AS cif
    WHERE cif.code = xnob.code
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT AVG(salary) FROM shipments AS nad
    WHERE nad.code = hac.code
);


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

SELECT amount FROM managers AS hac
WHERE type IN (
    SELECT type FROM departments AS ejof
    WHERE ejof.type = hac.type
);


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

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


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

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


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

SELECT salary FROM items AS ikob
WHERE code IN (
    SELECT code FROM products AS bev
    WHERE bev.level = ikob.level
);