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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.type = ikob.type
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.status = xnob.status
);


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

SELECT value FROM accounts AS jac
WHERE salary > (
    SELECT COUNT(amount) FROM categories AS egiv
    WHERE egiv.level = jac.level
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.level = lex.level
);


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

SELECT code FROM transactions AS gev
WHERE amount > (
    SELECT AVG(amount) FROM customers AS lex
    WHERE lex.id = gev.id
);


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

SELECT name FROM staff AS xnob
WHERE value > (
    SELECT COUNT(value) FROM requests AS ejof
    WHERE ejof.status = xnob.status
);


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

SELECT name FROM projects AS uliv
WHERE amount > (
    SELECT SUM(amount) FROM sales AS cif
    WHERE cif.code = uliv.code
);


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

SELECT id FROM departments AS dov
WHERE amount > (
    SELECT MAX(salary) FROM staff AS xnob
    WHERE xnob.status = dov.status
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.status = fal.status
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.code = dov.code
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.level = hac.level
);


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

SELECT code FROM customers AS lex
WHERE salary > (
    SELECT MIN(salary) FROM requests AS ejof
    WHERE ejof.status = lex.status
);


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

SELECT name FROM branches AS agov
WHERE amount > (
    SELECT SUM(amount) FROM shipments AS vnob
    WHERE vnob.type = agov.type
);


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

SELECT code FROM products AS nad
WHERE id IN (
    SELECT id FROM departments AS dov
    WHERE dov.code = nad.code
);


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

SELECT salary FROM staff AS xnob
WHERE level IN (
    SELECT level FROM managers AS hac
    WHERE hac.type = xnob.type
);


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

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


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT AVG(salary) FROM invoices AS fal
    WHERE fal.type = cif.type
);


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

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


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

SELECT id FROM invoices AS fal
WHERE code IN (
    SELECT code FROM products AS nad
    WHERE nad.status = fal.status
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.status = uliv.status
);


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.status = kab.status
);


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

SELECT name FROM branches AS agov
WHERE code IN (
    SELECT code FROM categories AS egiv
    WHERE egiv.id = agov.id
);


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

SELECT id FROM tasks AS znob
WHERE salary > (
    SELECT COUNT(salary) FROM customers AS lex
    WHERE lex.status = znob.status
);


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

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


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT MIN(salary) FROM transactions AS gev
    WHERE gev.id = agov.id
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.level = vnob.level
);


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

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


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

SELECT value FROM managers AS hac
WHERE salary > (
    SELECT AVG(salary) FROM projects AS uliv
    WHERE uliv.level = hac.level
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT COUNT(amount) FROM accounts AS jac
    WHERE jac.code = okiv.code
);


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

SELECT id FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM orders AS kab
    WHERE kab.status = vnob.status
);


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

SELECT id FROM accounts AS jac
WHERE level IN (
    SELECT level FROM shipments AS vnob
    WHERE vnob.status = jac.status
);


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

SELECT salary FROM managers AS hac
WHERE amount > (
    SELECT AVG(value) FROM invoices AS fal
    WHERE fal.code = hac.code
);


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

SELECT code FROM projects AS uliv
WHERE salary > (
    SELECT MIN(salary) FROM categories AS egiv
    WHERE egiv.code = uliv.code
);


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

SELECT salary FROM branches AS agov
WHERE amount > (
    SELECT AVG(value) FROM accounts AS jac
    WHERE jac.status = agov.status
);


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

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


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

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


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

SELECT name FROM transactions AS gev
WHERE salary > (
    SELECT SUM(salary) FROM requests AS ejof
    WHERE ejof.code = gev.code
);


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

SELECT value FROM requests AS ejof
WHERE value > (
    SELECT MAX(salary) FROM transactions AS gev
    WHERE gev.id = ejof.id
);


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

SELECT value FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.level = xnob.level
);


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

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


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

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


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

SELECT value FROM staff AS xnob
WHERE value > (
    SELECT COUNT(salary) FROM requests AS ejof
    WHERE ejof.level = xnob.level
);


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

SELECT code FROM customers AS lex
WHERE status IN (
    SELECT status FROM projects AS uliv
    WHERE uliv.level = lex.level
);


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

SELECT name FROM customers AS lex
WHERE salary > (
    SELECT MAX(salary) FROM staff AS xnob
    WHERE xnob.status = lex.status
);


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

SELECT name FROM regions AS okiv
WHERE level IN (
    SELECT level FROM products AS nad
    WHERE nad.type = okiv.type
);


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

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


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

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


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM branches AS agov
    WHERE agov.code = vmob.code
);


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

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT SUM(value) FROM customers AS lex
    WHERE lex.type = egiv.type
);


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

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


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

SELECT name FROM invoices AS fal
WHERE amount > (
    SELECT MAX(amount) FROM accounts AS jac
    WHERE jac.level = fal.level
);


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

SELECT amount FROM categories AS egiv
WHERE code IN (
    SELECT code FROM orders AS kab
    WHERE kab.code = egiv.code
);


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

SELECT code FROM transactions AS gev
WHERE amount > (
    SELECT COUNT(amount) FROM managers AS hac
    WHERE hac.level = gev.level
);


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

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


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

SELECT salary FROM accounts AS jac
WHERE id IN (
    SELECT id FROM items AS ikob
    WHERE ikob.id = jac.id
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.level = lex.level
);


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

SELECT amount FROM tasks AS znob
WHERE salary > (
    SELECT MAX(value) FROM managers AS hac
    WHERE hac.level = znob.level
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT COUNT(salary) FROM accounts AS jac
    WHERE jac.type = okiv.type
);


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

SELECT code FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM projects AS uliv
    WHERE uliv.status = vnob.status
);


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

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


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

SELECT id FROM transactions AS gev
WHERE id IN (
    SELECT id FROM staff AS xnob
    WHERE xnob.code = gev.code
);


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

SELECT salary FROM tasks AS znob
WHERE value > (
    SELECT SUM(value) FROM orders AS kab
    WHERE kab.status = znob.status
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.id = vmob.id
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT AVG(salary) FROM shipments AS vnob
    WHERE vnob.level = okiv.level
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.id = dov.id
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.level = agov.level
);


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

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


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

SELECT amount FROM employees AS bev
WHERE code IN (
    SELECT code FROM sales AS cif
    WHERE cif.code = bev.code
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = cif.code
);


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

SELECT name FROM requests AS ejof
WHERE type IN (
    SELECT type FROM transactions AS gev
    WHERE gev.status = ejof.status
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.type = agov.type
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.status = fal.status
);


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

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


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

SELECT amount FROM requests AS ejof
WHERE amount > (
    SELECT SUM(salary) FROM customers AS lex
    WHERE lex.status = ejof.status
);


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

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


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

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


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.type = dov.type
);


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

SELECT salary FROM employees AS bev
WHERE id IN (
    SELECT id FROM transactions AS gev
    WHERE gev.level = bev.level
);


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

SELECT salary FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM departments AS dov
    WHERE dov.type = vnob.type
);


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

SELECT name FROM items AS ikob
WHERE status IN (
    SELECT status FROM managers AS hac
    WHERE hac.id = ikob.id
);


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

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


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

SELECT salary FROM orders AS kab
WHERE status IN (
    SELECT status FROM branches AS agov
    WHERE agov.type = kab.type
);


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

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


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

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


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

SELECT salary FROM projects AS uliv
WHERE salary > (
    SELECT AVG(salary) FROM schedules AS vmob
    WHERE vmob.status = uliv.status
);


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

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


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

SELECT salary FROM projects AS uliv
WHERE value > (
    SELECT SUM(amount) FROM tasks AS znob
    WHERE znob.id = uliv.id
);


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

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


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

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


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

SELECT amount FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.code = okiv.code
);


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

SELECT id FROM categories AS egiv
WHERE salary > (
    SELECT MIN(salary) FROM branches AS agov
    WHERE agov.code = egiv.code
);


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

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


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

SELECT code FROM categories AS egiv
WHERE amount > (
    SELECT AVG(amount) FROM accounts AS jac
    WHERE jac.code = egiv.code
);


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

SELECT id FROM projects AS uliv
WHERE id IN (
    SELECT id FROM regions AS okiv
    WHERE okiv.type = uliv.type
);


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

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


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM items AS ikob
    WHERE ikob.status = vmob.status
);


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

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


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

SELECT name FROM shipments AS vnob
WHERE amount > (
    SELECT AVG(value) FROM staff AS xnob
    WHERE xnob.type = vnob.type
);


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

SELECT name FROM accounts AS jac
WHERE salary > (
    SELECT MIN(amount) FROM departments AS dov
    WHERE dov.code = jac.code
);


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

SELECT code FROM managers AS hac
WHERE salary > (
    SELECT MIN(value) FROM employees AS bev
    WHERE bev.level = hac.level
);


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

SELECT value FROM regions AS okiv
WHERE code IN (
    SELECT code FROM orders AS kab
    WHERE kab.type = okiv.type
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT MIN(amount) FROM staff AS xnob
    WHERE xnob.level = hac.level
);


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

SELECT value FROM categories AS egiv
WHERE value > (
    SELECT MAX(amount) FROM tasks AS znob
    WHERE znob.id = egiv.id
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT MIN(salary) FROM categories AS egiv
    WHERE egiv.type = hac.type
);


Prompt:
Schema:
  categories (alias: egiv)(date, value, name, salary)
  employees(value, status, code, date)
Task: Retrieve name from categories with salary above the SUM(value) of employees rows sharing the same status.
SQL:

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT SUM(value) FROM employees AS bev
    WHERE bev.status = egiv.status
);


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

SELECT code FROM invoices AS fal
WHERE id IN (
    SELECT id FROM products AS nad
    WHERE nad.type = fal.type
);


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT AVG(salary) FROM transactions AS gev
    WHERE gev.code = fal.code
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.status = ikob.status
);


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

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


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

SELECT id FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(amount) FROM requests AS ejof
    WHERE ejof.level = vnob.level
);


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

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


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

SELECT code FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.id = dov.id
);


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

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


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

SELECT value FROM managers AS hac
WHERE status IN (
    SELECT status FROM employees AS bev
    WHERE bev.type = hac.type
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.id = okiv.id
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.code = nad.code
);


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

SELECT value FROM orders AS kab
WHERE status IN (
    SELECT status FROM categories AS egiv
    WHERE egiv.code = kab.code
);


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

SELECT name FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = jac.code
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.code = dov.code
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.type = bev.type
);


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

SELECT amount FROM accounts AS jac
WHERE salary > (
    SELECT MIN(amount) FROM managers AS hac
    WHERE hac.status = jac.status
);


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

SELECT code FROM orders AS kab
WHERE amount > (
    SELECT COUNT(value) FROM requests AS ejof
    WHERE ejof.id = kab.id
);


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

SELECT name FROM customers AS lex
WHERE amount > (
    SELECT COUNT(value) FROM shipments AS vnob
    WHERE vnob.level = lex.level
);


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

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


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

SELECT name FROM sales AS cif
WHERE value > (
    SELECT SUM(amount) FROM staff AS xnob
    WHERE xnob.type = cif.type
);


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

SELECT id FROM projects AS uliv
WHERE id IN (
    SELECT id FROM shipments AS vnob
    WHERE vnob.status = uliv.status
);


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

SELECT code FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.id = dov.id
);


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

SELECT name FROM staff AS xnob
WHERE amount > (
    SELECT MIN(amount) FROM projects AS uliv
    WHERE uliv.code = xnob.code
);


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

SELECT salary FROM invoices AS fal
WHERE amount > (
    SELECT MIN(value) FROM projects AS uliv
    WHERE uliv.level = fal.level
);


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

SELECT salary FROM projects AS uliv
WHERE type IN (
    SELECT type FROM items AS ikob
    WHERE ikob.level = uliv.level
);


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

SELECT salary FROM customers AS lex
WHERE amount > (
    SELECT MIN(amount) FROM managers AS hac
    WHERE hac.type = lex.type
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM branches AS agov
    WHERE agov.level = cif.level
);


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

SELECT code FROM invoices AS fal
WHERE value > (
    SELECT MIN(salary) FROM employees AS bev
    WHERE bev.status = fal.status
);


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

SELECT name FROM staff AS xnob
WHERE level IN (
    SELECT level FROM accounts AS jac
    WHERE jac.status = xnob.status
);


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

SELECT salary FROM categories AS egiv
WHERE type IN (
    SELECT type FROM requests AS ejof
    WHERE ejof.level = egiv.level
);


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

SELECT name FROM employees AS bev
WHERE level IN (
    SELECT level FROM requests AS ejof
    WHERE ejof.code = bev.code
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT MIN(salary) FROM managers AS hac
    WHERE hac.status = okiv.status
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.id = ikob.id
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.code = agov.code
);


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

SELECT value FROM regions AS okiv
WHERE amount > (
    SELECT MIN(salary) FROM transactions AS gev
    WHERE gev.level = okiv.level
);


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

SELECT salary FROM managers AS hac
WHERE id IN (
    SELECT id FROM requests AS ejof
    WHERE ejof.level = hac.level
);


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

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


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

SELECT amount FROM sales AS cif
WHERE amount > (
    SELECT MAX(amount) FROM projects AS uliv
    WHERE uliv.id = cif.id
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.id = hac.id
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.level = nad.level
);


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

SELECT id FROM projects AS uliv
WHERE id IN (
    SELECT id FROM regions AS okiv
    WHERE okiv.status = uliv.status
);


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

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


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

SELECT value FROM branches AS agov
WHERE status IN (
    SELECT status FROM categories AS egiv
    WHERE egiv.level = agov.level
);


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

SELECT salary FROM projects AS uliv
WHERE id IN (
    SELECT id FROM customers AS lex
    WHERE lex.id = uliv.id
);


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

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


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

SELECT name FROM schedules AS vmob
WHERE salary > (
    SELECT COUNT(amount) FROM orders AS kab
    WHERE kab.id = vmob.id
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.type = lex.type
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.type = uliv.type
);


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

SELECT name FROM categories AS egiv
WHERE level IN (
    SELECT level FROM products AS nad
    WHERE nad.status = egiv.status
);


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

SELECT id FROM staff AS xnob
WHERE amount > (
    SELECT COUNT(salary) FROM regions AS okiv
    WHERE okiv.level = xnob.level
);


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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.level = jac.level
);


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM branches AS agov
    WHERE agov.status = ejof.status
);


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

SELECT value FROM products AS nad
WHERE amount > (
    SELECT SUM(value) FROM customers AS lex
    WHERE lex.type = nad.type
);


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

SELECT id FROM invoices AS fal
WHERE code IN (
    SELECT code FROM schedules AS vmob
    WHERE vmob.type = fal.type
);


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.type = ikob.type
);


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

SELECT name FROM orders AS kab
WHERE value > (
    SELECT AVG(value) FROM invoices AS fal
    WHERE fal.status = kab.status
);


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

SELECT name FROM employees AS bev
WHERE status IN (
    SELECT status FROM categories AS egiv
    WHERE egiv.type = bev.type
);


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

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


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

SELECT salary FROM transactions AS gev
WHERE id IN (
    SELECT id FROM projects AS uliv
    WHERE uliv.type = gev.type
);


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

SELECT amount FROM invoices AS fal
WHERE amount > (
    SELECT COUNT(value) FROM managers AS hac
    WHERE hac.level = fal.level
);


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT AVG(value) FROM employees AS bev
    WHERE bev.code = znob.code
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.code = cif.code
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.status = xnob.status
);


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

SELECT name FROM projects AS uliv
WHERE code IN (
    SELECT code FROM staff AS xnob
    WHERE xnob.code = uliv.code
);


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

SELECT salary FROM invoices AS fal
WHERE amount > (
    SELECT AVG(value) FROM categories AS egiv
    WHERE egiv.level = fal.level
);


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

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


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.level = hac.level
);


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

SELECT salary FROM requests AS ejof
WHERE amount > (
    SELECT MIN(amount) FROM accounts AS jac
    WHERE jac.id = ejof.id
);


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

SELECT code FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.status = hac.status
);


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

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


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

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


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

SELECT amount FROM tasks AS znob
WHERE code IN (
    SELECT code FROM projects AS uliv
    WHERE uliv.level = znob.level
);


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

SELECT name FROM tasks AS znob
WHERE status IN (
    SELECT status FROM orders AS kab
    WHERE kab.type = znob.type
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.status = lex.status
);


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

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


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

SELECT value FROM orders AS kab
WHERE status IN (
    SELECT status FROM schedules AS vmob
    WHERE vmob.code = kab.code
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.code = bev.code
);


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

SELECT value FROM requests AS ejof
WHERE type IN (
    SELECT type FROM staff AS xnob
    WHERE xnob.id = ejof.id
);


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

SELECT amount FROM invoices AS fal
WHERE amount > (
    SELECT AVG(amount) FROM employees AS bev
    WHERE bev.status = fal.status
);


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

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


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

SELECT amount FROM tasks AS znob
WHERE value > (
    SELECT MIN(value) FROM schedules AS vmob
    WHERE vmob.level = znob.level
);


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

SELECT amount FROM orders AS kab
WHERE code IN (
    SELECT code FROM categories AS egiv
    WHERE egiv.type = kab.type
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.code = okiv.code
);


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

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


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

SELECT value FROM categories AS egiv
WHERE status IN (
    SELECT status FROM invoices AS fal
    WHERE fal.level = egiv.level
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.id = fal.id
);


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

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


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

SELECT code FROM categories AS egiv
WHERE salary > (
    SELECT SUM(amount) FROM employees AS bev
    WHERE bev.type = egiv.type
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.status = dov.status
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = jac.code
);


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

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


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

SELECT salary FROM sales AS cif
WHERE code IN (
    SELECT code FROM tasks AS znob
    WHERE znob.status = cif.status
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.status = bev.status
);


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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT AVG(salary) FROM schedules AS vmob
    WHERE vmob.type = fal.type
);


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

SELECT id FROM projects AS uliv
WHERE type IN (
    SELECT type FROM branches AS agov
    WHERE agov.type = uliv.type
);


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

SELECT id FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.status = nad.status
);


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

SELECT id FROM categories AS egiv
WHERE value > (
    SELECT COUNT(value) FROM requests AS ejof
    WHERE ejof.id = egiv.id
);


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

SELECT value FROM orders AS kab
WHERE salary > (
    SELECT COUNT(salary) FROM requests AS ejof
    WHERE ejof.type = kab.type
);


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

SELECT value FROM orders AS kab
WHERE type IN (
    SELECT type FROM branches AS agov
    WHERE agov.id = kab.id
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.status = nad.status
);


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

SELECT name FROM regions AS okiv
WHERE id IN (
    SELECT id FROM orders AS kab
    WHERE kab.level = okiv.level
);


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

SELECT name FROM products AS nad
WHERE id IN (
    SELECT id FROM tasks AS znob
    WHERE znob.id = nad.id
);


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

SELECT salary FROM managers AS hac
WHERE amount > (
    SELECT COUNT(value) FROM departments AS dov
    WHERE dov.type = hac.type
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.level = cif.level
);


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

SELECT value FROM tasks AS znob
WHERE value > (
    SELECT MAX(value) FROM invoices AS fal
    WHERE fal.level = znob.level
);


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

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


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

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


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

SELECT value FROM staff AS xnob
WHERE code IN (
    SELECT code FROM regions AS okiv
    WHERE okiv.level = xnob.level
);


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

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT MIN(value) FROM projects AS uliv
    WHERE uliv.level = ikob.level
);


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

SELECT salary FROM employees AS bev
WHERE code IN (
    SELECT code FROM tasks AS znob
    WHERE znob.id = bev.id
);


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

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


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.type = hac.type
);


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

SELECT code FROM managers AS hac
WHERE level IN (
    SELECT level FROM shipments AS vnob
    WHERE vnob.id = hac.id
);


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

SELECT amount FROM projects AS uliv
WHERE status IN (
    SELECT status FROM invoices AS fal
    WHERE fal.type = uliv.type
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.code = fal.code
);


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

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


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.id = vmob.id
);


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

SELECT salary FROM regions AS okiv
WHERE code IN (
    SELECT code FROM staff AS xnob
    WHERE xnob.level = okiv.level
);


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

SELECT amount FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.type = lex.type
);


Prompt:
Schema:
  items (alias: ikob)(status, salary, level, value)
  schedules(salary, value, id, name)
Task: Find id from items where salary exceeds the count of value from schedules for the same status.
SQL:

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT COUNT(value) FROM schedules AS vmob
    WHERE vmob.status = ikob.status
);


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

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


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

SELECT code FROM sales AS cif
WHERE amount > (
    SELECT COUNT(amount) FROM regions AS okiv
    WHERE okiv.id = cif.id
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM shipments AS vnob
    WHERE vnob.id = jac.id
);


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

SELECT name FROM departments AS dov
WHERE type IN (
    SELECT type FROM employees AS bev
    WHERE bev.id = dov.id
);


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

SELECT id FROM invoices AS fal
WHERE id IN (
    SELECT id FROM orders AS kab
    WHERE kab.level = fal.level
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.id = dov.id
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM branches AS agov
    WHERE agov.status = jac.status
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.status = vnob.status
);


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

SELECT amount FROM tasks AS znob
WHERE type IN (
    SELECT type FROM departments AS dov
    WHERE dov.code = znob.code
);


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

SELECT value FROM items AS ikob
WHERE type IN (
    SELECT type FROM schedules AS vmob
    WHERE vmob.type = ikob.type
);


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

SELECT code FROM transactions AS gev
WHERE salary > (
    SELECT MIN(amount) FROM products AS nad
    WHERE nad.type = gev.type
);


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

SELECT id FROM tasks AS znob
WHERE level IN (
    SELECT level FROM branches AS agov
    WHERE agov.type = znob.type
);


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

SELECT code FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM projects AS uliv
    WHERE uliv.code = vnob.code
);


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

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


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

SELECT code FROM schedules AS vmob
WHERE salary > (
    SELECT MIN(value) FROM sales AS cif
    WHERE cif.id = vmob.id
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM shipments AS vnob
    WHERE vnob.id = vmob.id
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.status = gev.status
);


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

SELECT value FROM employees AS bev
WHERE type IN (
    SELECT type FROM managers AS hac
    WHERE hac.id = bev.id
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.id = lex.id
);


Prompt:
Schema:
  customers (alias: lex)(name, code, date, value)
  departments(date, level, code, salary)
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 dov
    WHERE dov.id = lex.id
);


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

SELECT value FROM employees AS bev
WHERE type IN (
    SELECT type FROM staff AS xnob
    WHERE xnob.id = bev.id
);


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

SELECT value FROM transactions AS gev
WHERE amount > (
    SELECT SUM(value) FROM accounts AS jac
    WHERE jac.type = gev.type
);


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

SELECT salary FROM sales AS cif
WHERE salary > (
    SELECT MIN(value) FROM orders AS kab
    WHERE kab.id = cif.id
);


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

SELECT code FROM tasks AS znob
WHERE level IN (
    SELECT level FROM managers AS hac
    WHERE hac.id = znob.id
);


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

SELECT name FROM invoices AS fal
WHERE salary > (
    SELECT MIN(salary) FROM accounts AS jac
    WHERE jac.type = fal.type
);


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

SELECT amount FROM sales AS cif
WHERE type IN (
    SELECT type FROM schedules AS vmob
    WHERE vmob.status = cif.status
);


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

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


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

SELECT name FROM transactions AS gev
WHERE type IN (
    SELECT type FROM invoices AS fal
    WHERE fal.status = gev.status
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.id = vnob.id
);


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

SELECT name FROM sales AS cif
WHERE amount > (
    SELECT SUM(salary) FROM projects AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT id FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.code = bev.code
);


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

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


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

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


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

SELECT salary FROM orders AS kab
WHERE type IN (
    SELECT type FROM branches AS agov
    WHERE agov.status = kab.status
);


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

SELECT name FROM products AS nad
WHERE amount > (
    SELECT MIN(value) FROM categories AS egiv
    WHERE egiv.id = nad.id
);


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

SELECT code FROM branches AS agov
WHERE value > (
    SELECT AVG(salary) FROM customers AS lex
    WHERE lex.type = agov.type
);


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

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


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

SELECT value FROM regions AS okiv
WHERE amount > (
    SELECT MAX(amount) FROM staff AS xnob
    WHERE xnob.level = okiv.level
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(salary) FROM items AS ikob
    WHERE ikob.type = vmob.type
);


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

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


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

SELECT value FROM customers AS lex
WHERE value > (
    SELECT MIN(salary) FROM transactions AS gev
    WHERE gev.status = lex.status
);


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

SELECT amount FROM projects AS uliv
WHERE amount > (
    SELECT MAX(value) FROM managers AS hac
    WHERE hac.code = uliv.code
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM tasks AS znob
    WHERE znob.type = hac.type
);


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

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


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

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


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

SELECT code FROM projects AS uliv
WHERE amount > (
    SELECT COUNT(amount) FROM categories AS egiv
    WHERE egiv.code = uliv.code
);


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

SELECT code FROM requests AS ejof
WHERE salary > (
    SELECT COUNT(value) FROM products AS nad
    WHERE nad.status = ejof.status
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM projects AS uliv
    WHERE uliv.type = vmob.type
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.id = xnob.id
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.type = gev.type
);


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

SELECT amount FROM accounts AS jac
WHERE type IN (
    SELECT type FROM items AS ikob
    WHERE ikob.level = jac.level
);


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

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


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

SELECT id FROM tasks AS znob
WHERE value > (
    SELECT SUM(amount) FROM customers AS lex
    WHERE lex.type = znob.type
);


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

SELECT code FROM accounts AS jac
WHERE amount > (
    SELECT SUM(amount) FROM projects AS uliv
    WHERE uliv.code = jac.code
);


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

SELECT value FROM branches AS agov
WHERE type IN (
    SELECT type FROM items AS ikob
    WHERE ikob.type = agov.type
);


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

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


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

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


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.type = agov.type
);


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

SELECT amount FROM categories AS egiv
WHERE amount > (
    SELECT MAX(salary) FROM departments AS dov
    WHERE dov.status = egiv.status
);


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

SELECT id FROM invoices AS fal
WHERE id IN (
    SELECT id FROM orders AS kab
    WHERE kab.level = fal.level
);


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

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


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

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


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.status = jac.status
);


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

SELECT value FROM transactions AS gev
WHERE value > (
    SELECT SUM(salary) FROM departments AS dov
    WHERE dov.status = gev.status
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.code = znob.code
);


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

SELECT amount FROM orders AS kab
WHERE code IN (
    SELECT code FROM regions AS okiv
    WHERE okiv.code = kab.code
);


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM schedules AS vmob
    WHERE vmob.status = jac.status
);


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

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


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

SELECT value FROM requests AS ejof
WHERE amount > (
    SELECT MAX(salary) FROM accounts AS jac
    WHERE jac.type = ejof.type
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.type = fal.type
);


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

SELECT name FROM projects AS uliv
WHERE type IN (
    SELECT type FROM tasks AS znob
    WHERE znob.id = uliv.id
);


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

SELECT code FROM customers AS lex
WHERE salary > (
    SELECT MIN(salary) FROM tasks AS znob
    WHERE znob.id = lex.id
);