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

SELECT salary FROM accounts AS jac
WHERE code IN (
    SELECT code FROM items AS egiv
    WHERE egiv.type = jac.type
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM transactions AS egiv
    WHERE egiv.code = hac.code
);


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

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


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

SELECT salary FROM regions AS okiv
WHERE type IN (
    SELECT type FROM transactions AS lex
    WHERE lex.type = okiv.type
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT SUM(amount) FROM products AS kab
    WHERE kab.code = vmob.code
);


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

SELECT name FROM accounts AS jac
WHERE amount > (
    SELECT AVG(value) FROM managers AS ikob
    WHERE ikob.type = jac.type
);


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

SELECT salary FROM staff AS xnob
WHERE level IN (
    SELECT level FROM invoices AS znob
    WHERE znob.status = xnob.status
);


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

SELECT amount FROM tasks AS znob
WHERE amount > (
    SELECT AVG(salary) FROM shipments AS nad
    WHERE nad.level = znob.level
);


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

SELECT salary FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM accounts AS znob
    WHERE znob.level = vmob.level
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM orders AS znob
    WHERE znob.type = dov.type
);


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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT MAX(amount) FROM requests AS bev
    WHERE bev.code = fal.code
);


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

SELECT value FROM requests AS ejof
WHERE value > (
    SELECT SUM(salary) FROM tasks AS kab
    WHERE kab.code = ejof.code
);


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

SELECT amount FROM sales AS cif
WHERE id IN (
    SELECT id FROM schedules AS egiv
    WHERE egiv.level = cif.level
);


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

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


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

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


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

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


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM transactions AS uliv
    WHERE uliv.level = znob.level
);


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

SELECT code FROM transactions AS gev
WHERE level IN (
    SELECT level FROM orders AS vnob
    WHERE vnob.id = gev.id
);


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

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


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

SELECT value FROM departments AS dov
WHERE value > (
    SELECT SUM(amount) FROM invoices AS vnob
    WHERE vnob.status = dov.status
);


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM schedules AS hac
    WHERE hac.type = ejof.type
);


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM departments AS uliv
    WHERE uliv.type = ejof.type
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM departments AS bev
    WHERE bev.id = gev.id
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.status = fal.status
);


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

SELECT salary FROM departments AS dov
WHERE level IN (
    SELECT level FROM shipments AS okiv
    WHERE okiv.level = dov.level
);


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

SELECT value FROM products AS nad
WHERE id IN (
    SELECT id FROM orders AS vmob
    WHERE vmob.id = nad.id
);


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

SELECT code FROM branches AS agov
WHERE code IN (
    SELECT code FROM transactions AS gev
    WHERE gev.level = agov.level
);


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

SELECT id FROM items AS ikob
WHERE amount > (
    SELECT MIN(amount) FROM schedules AS jac
    WHERE jac.type = ikob.type
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM accounts AS gev
    WHERE gev.level = dov.level
);


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

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


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

SELECT salary FROM items AS ikob
WHERE type IN (
    SELECT type FROM categories AS xnob
    WHERE xnob.level = ikob.level
);


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

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


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

SELECT amount FROM sales AS cif
WHERE code IN (
    SELECT code FROM schedules AS fal
    WHERE fal.id = cif.id
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE level IN (
    SELECT level FROM tasks AS okiv
    WHERE okiv.type = xnob.type
);


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

SELECT salary FROM staff AS xnob
WHERE id IN (
    SELECT id FROM items AS vnob
    WHERE vnob.code = xnob.code
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM items AS dov
    WHERE dov.id = uliv.id
);


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

SELECT value FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(amount) FROM categories AS uliv
    WHERE uliv.id = vnob.id
);


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

SELECT name FROM products AS nad
WHERE value > (
    SELECT MIN(salary) FROM invoices AS ejof
    WHERE ejof.status = nad.status
);


Prompt:
Schema:
  accounts (alias: jac)(name, status, value, level)
  items(amount, value, level, type)
Task: Find name from accounts where value exceeds the total value from items for the same level.
SQL:

SELECT name FROM accounts AS jac
WHERE value > (
    SELECT SUM(value) FROM items AS egiv
    WHERE egiv.level = jac.level
);


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

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


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

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


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM categories AS nad
    WHERE nad.code = kab.code
);


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

SELECT value FROM regions AS okiv
WHERE id IN (
    SELECT id FROM schedules AS ejof
    WHERE ejof.level = okiv.level
);


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

SELECT amount FROM shipments AS vnob
WHERE salary > (
    SELECT COUNT(amount) FROM departments AS agov
    WHERE agov.code = vnob.code
);


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM branches AS vnob
    WHERE vnob.id = znob.id
);


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

SELECT value FROM departments AS dov
WHERE code IN (
    SELECT code FROM regions AS ejof
    WHERE ejof.status = dov.status
);


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

SELECT name FROM products AS nad
WHERE code IN (
    SELECT code FROM regions AS xnob
    WHERE xnob.id = nad.id
);


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

SELECT code FROM categories AS egiv
WHERE value > (
    SELECT COUNT(value) FROM regions AS uliv
    WHERE uliv.status = egiv.status
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM staff AS nad
    WHERE nad.status = dov.status
);


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

SELECT value FROM categories AS egiv
WHERE value > (
    SELECT AVG(value) FROM managers AS okiv
    WHERE okiv.id = egiv.id
);


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

SELECT name FROM regions AS okiv
WHERE amount > (
    SELECT MIN(value) FROM departments AS cif
    WHERE cif.id = okiv.id
);


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

SELECT code FROM invoices AS fal
WHERE value > (
    SELECT AVG(salary) FROM products AS okiv
    WHERE okiv.id = fal.id
);


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

SELECT amount FROM transactions AS gev
WHERE amount > (
    SELECT AVG(value) FROM staff AS ikob
    WHERE ikob.code = gev.code
);


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

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


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM transactions AS uliv
    WHERE uliv.status = fal.status
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM invoices AS kab
    WHERE kab.status = egiv.status
);


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

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


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

SELECT value FROM transactions AS gev
WHERE amount > (
    SELECT MIN(value) FROM departments AS kab
    WHERE kab.status = gev.status
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM invoices AS dov
    WHERE dov.id = jac.id
);


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

SELECT salary FROM managers AS hac
WHERE status IN (
    SELECT status FROM transactions AS vnob
    WHERE vnob.level = hac.level
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM shipments AS ikob
    WHERE ikob.code = bev.code
);


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

SELECT code FROM items AS ikob
WHERE id IN (
    SELECT id FROM managers AS fal
    WHERE fal.type = ikob.type
);


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

SELECT amount FROM items AS ikob
WHERE salary > (
    SELECT MAX(salary) FROM transactions AS ejof
    WHERE ejof.id = ikob.id
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM managers AS bev
    WHERE bev.id = dov.id
);


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

SELECT salary FROM categories AS egiv
WHERE amount > (
    SELECT MAX(salary) FROM transactions AS hac
    WHERE hac.code = egiv.code
);


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

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


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

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


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM orders AS xnob
    WHERE xnob.level = bev.level
);


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

SELECT code FROM branches AS agov
WHERE id IN (
    SELECT id FROM staff AS ikob
    WHERE ikob.type = agov.type
);


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

SELECT salary FROM shipments AS vnob
WHERE salary > (
    SELECT SUM(salary) FROM categories AS jac
    WHERE jac.id = vnob.id
);


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

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


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS egiv
    WHERE egiv.status = nad.status
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS nad
    WHERE nad.id = okiv.id
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM categories AS vmob
    WHERE vmob.id = ejof.id
);


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

SELECT id FROM requests AS ejof
WHERE level IN (
    SELECT level FROM schedules AS vnob
    WHERE vnob.code = ejof.code
);


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

SELECT code FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(amount) FROM transactions AS jac
    WHERE jac.level = znob.level
);


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

SELECT id FROM employees AS bev
WHERE type IN (
    SELECT type FROM regions AS dov
    WHERE dov.level = bev.level
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS bev
    WHERE bev.id = vnob.id
);


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

SELECT value FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.id = egiv.id
);


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

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


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

SELECT amount FROM orders AS kab
WHERE type IN (
    SELECT type FROM accounts AS hac
    WHERE hac.code = kab.code
);


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

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


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

SELECT value FROM customers AS lex
WHERE type IN (
    SELECT type FROM items AS egiv
    WHERE egiv.code = lex.code
);


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

SELECT name FROM sales AS cif
WHERE amount > (
    SELECT SUM(salary) FROM employees AS dov
    WHERE dov.level = cif.level
);


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

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


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

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


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

SELECT id FROM tasks AS znob
WHERE amount > (
    SELECT SUM(amount) FROM employees AS cif
    WHERE cif.level = znob.level
);


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

SELECT salary FROM branches AS agov
WHERE salary > (
    SELECT AVG(value) FROM transactions AS nad
    WHERE nad.level = agov.level
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.id = fal.id
);


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

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


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

SELECT amount FROM shipments AS vnob
WHERE salary > (
    SELECT MAX(salary) FROM categories AS hac
    WHERE hac.status = vnob.status
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT AVG(value) FROM departments AS lex
    WHERE lex.type = okiv.type
);


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

SELECT code FROM shipments AS vnob
WHERE value > (
    SELECT MIN(salary) FROM employees AS znob
    WHERE znob.code = vnob.code
);


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

SELECT code FROM items AS ikob
WHERE value > (
    SELECT SUM(value) FROM requests AS bev
    WHERE bev.level = ikob.level
);


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

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


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

SELECT id FROM managers AS hac
WHERE level IN (
    SELECT level FROM invoices AS lex
    WHERE lex.type = hac.type
);


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

SELECT id FROM accounts AS jac
WHERE id IN (
    SELECT id FROM regions AS xnob
    WHERE xnob.level = jac.level
);


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

SELECT amount FROM customers AS lex
WHERE type IN (
    SELECT type FROM products AS ikob
    WHERE ikob.id = lex.id
);


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

SELECT code FROM branches AS agov
WHERE salary > (
    SELECT MIN(amount) FROM employees AS vnob
    WHERE vnob.id = agov.id
);


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM schedules AS okiv
    WHERE okiv.id = agov.id
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM requests AS hac
    WHERE hac.type = egiv.type
);


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

SELECT code FROM items AS ikob
WHERE level IN (
    SELECT level FROM employees AS kab
    WHERE kab.id = ikob.id
);


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

SELECT amount FROM staff AS xnob
WHERE id IN (
    SELECT id FROM sales AS fal
    WHERE fal.id = xnob.id
);


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

SELECT salary FROM orders AS kab
WHERE salary > (
    SELECT COUNT(salary) FROM shipments AS ikob
    WHERE ikob.type = kab.type
);


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

SELECT code FROM requests AS ejof
WHERE id IN (
    SELECT id FROM departments AS dov
    WHERE dov.level = ejof.level
);


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

SELECT amount FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(value) FROM products AS bev
    WHERE bev.code = ejof.code
);


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

SELECT value FROM sales AS cif
WHERE amount > (
    SELECT MIN(amount) FROM items AS jac
    WHERE jac.status = cif.status
);


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

SELECT name FROM departments AS dov
WHERE code IN (
    SELECT code FROM sales AS egiv
    WHERE egiv.level = dov.level
);


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

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


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

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


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

SELECT amount FROM products AS nad
WHERE type IN (
    SELECT type FROM items AS kab
    WHERE kab.type = nad.type
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM orders AS vnob
    WHERE vnob.type = jac.type
);


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

SELECT amount FROM customers AS lex
WHERE status IN (
    SELECT status FROM regions AS hac
    WHERE hac.level = lex.level
);


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

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


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

SELECT amount FROM schedules AS vmob
WHERE amount > (
    SELECT MAX(salary) FROM products AS lex
    WHERE lex.type = vmob.type
);


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM transactions AS dov
    WHERE dov.level = ikob.level
);


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

SELECT code FROM tasks AS znob
WHERE type IN (
    SELECT type FROM projects AS bev
    WHERE bev.type = znob.type
);


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

SELECT name FROM sales AS cif
WHERE code IN (
    SELECT code FROM categories AS egiv
    WHERE egiv.code = cif.code
);


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

SELECT amount FROM customers AS lex
WHERE status IN (
    SELECT status FROM sales AS uliv
    WHERE uliv.level = lex.level
);


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

SELECT value FROM orders AS kab
WHERE code IN (
    SELECT code FROM departments AS uliv
    WHERE uliv.id = kab.id
);


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

SELECT name FROM employees AS bev
WHERE amount > (
    SELECT MAX(value) FROM requests AS gev
    WHERE gev.code = bev.code
);


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

SELECT value FROM accounts AS jac
WHERE status IN (
    SELECT status FROM tasks AS agov
    WHERE agov.status = jac.status
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS kab
    WHERE kab.type = lex.type
);


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

SELECT salary FROM transactions AS gev
WHERE value > (
    SELECT SUM(salary) FROM orders AS agov
    WHERE agov.type = gev.type
);


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

SELECT id FROM projects AS uliv
WHERE salary > (
    SELECT MIN(amount) FROM schedules AS znob
    WHERE znob.status = uliv.status
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM employees AS znob
    WHERE znob.status = hac.status
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM employees AS hac
    WHERE hac.status = lex.status
);


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

SELECT salary FROM invoices AS fal
WHERE code IN (
    SELECT code FROM categories AS nad
    WHERE nad.id = fal.id
);


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT SUM(amount) FROM customers AS jac
    WHERE jac.type = agov.type
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM schedules AS fal
    WHERE fal.status = gev.status
);


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

SELECT name FROM tasks AS znob
WHERE type IN (
    SELECT type FROM branches AS agov
    WHERE agov.status = znob.status
);


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

SELECT code FROM employees AS bev
WHERE value > (
    SELECT COUNT(salary) FROM staff AS ejof
    WHERE ejof.status = bev.status
);


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

SELECT code FROM sales AS cif
WHERE level IN (
    SELECT level FROM regions AS ikob
    WHERE ikob.code = cif.code
);


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

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


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

SELECT amount FROM transactions AS gev
WHERE code IN (
    SELECT code FROM invoices AS agov
    WHERE agov.id = gev.id
);


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

SELECT id FROM categories AS egiv
WHERE amount > (
    SELECT MIN(amount) FROM projects AS ikob
    WHERE ikob.status = egiv.status
);


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM categories AS lex
    WHERE lex.status = uliv.status
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM employees AS vmob
    WHERE vmob.id = kab.id
);


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

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


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

SELECT amount FROM departments AS dov
WHERE salary > (
    SELECT MIN(value) FROM staff AS lex
    WHERE lex.code = dov.code
);


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

SELECT amount FROM employees AS bev
WHERE status IN (
    SELECT status FROM branches AS dov
    WHERE dov.id = bev.id
);


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

SELECT amount FROM projects AS uliv
WHERE salary > (
    SELECT SUM(amount) FROM invoices AS dov
    WHERE dov.type = uliv.type
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM departments AS fal
    WHERE fal.level = kab.level
);


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

SELECT name FROM orders AS kab
WHERE type IN (
    SELECT type FROM transactions AS cif
    WHERE cif.status = kab.status
);


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

SELECT code FROM projects AS uliv
WHERE code IN (
    SELECT code FROM transactions AS kab
    WHERE kab.level = uliv.level
);


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

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


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

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


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

SELECT value FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM orders AS okiv
    WHERE okiv.type = vmob.type
);


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM sales AS uliv
    WHERE uliv.code = kab.code
);


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

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


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

SELECT value FROM managers AS hac
WHERE salary > (
    SELECT SUM(value) FROM departments AS vnob
    WHERE vnob.level = hac.level
);


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

SELECT salary FROM regions AS okiv
WHERE level IN (
    SELECT level FROM products AS ikob
    WHERE ikob.code = okiv.code
);


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

SELECT amount FROM sales AS cif
WHERE salary > (
    SELECT MIN(salary) FROM staff AS gev
    WHERE gev.type = cif.type
);


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

SELECT code FROM regions AS okiv
WHERE status IN (
    SELECT status FROM departments AS uliv
    WHERE uliv.level = okiv.level
);


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

SELECT name FROM invoices AS fal
WHERE id IN (
    SELECT id FROM transactions AS nad
    WHERE nad.id = fal.id
);


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

SELECT salary FROM requests AS ejof
WHERE value > (
    SELECT MAX(amount) FROM orders AS lex
    WHERE lex.status = ejof.status
);


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

SELECT amount FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(value) FROM branches AS gev
    WHERE gev.level = vnob.level
);


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

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


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

SELECT value FROM transactions AS gev
WHERE code IN (
    SELECT code FROM requests AS ejof
    WHERE ejof.status = gev.status
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM orders AS ejof
    WHERE ejof.type = lex.type
);


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

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


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS bev
    WHERE bev.type = vnob.type
);


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

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


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

SELECT salary FROM employees AS bev
WHERE amount > (
    SELECT MIN(value) FROM customers AS nad
    WHERE nad.code = bev.code
);


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

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


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

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


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

SELECT id FROM employees AS bev
WHERE salary > (
    SELECT AVG(salary) FROM transactions AS uliv
    WHERE uliv.status = bev.status
);


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM regions AS kab
    WHERE kab.level = vmob.level
);


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

SELECT value FROM tasks AS znob
WHERE salary > (
    SELECT MAX(value) FROM staff AS cif
    WHERE cif.type = znob.type
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM projects AS vmob
    WHERE vmob.type = hac.type
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM branches AS egiv
    WHERE egiv.id = kab.id
);


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

SELECT amount FROM schedules AS vmob
WHERE amount > (
    SELECT COUNT(amount) FROM departments AS ejof
    WHERE ejof.status = vmob.status
);


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

SELECT value FROM customers AS lex
WHERE code IN (
    SELECT code FROM employees AS uliv
    WHERE uliv.level = lex.level
);


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

SELECT code FROM sales AS cif
WHERE amount > (
    SELECT MAX(salary) FROM employees AS uliv
    WHERE uliv.level = cif.level
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT AVG(value) FROM tasks AS fal
    WHERE fal.level = kab.level
);


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

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


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

SELECT salary FROM products AS nad
WHERE status IN (
    SELECT status FROM branches AS egiv
    WHERE egiv.type = nad.type
);


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

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


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

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


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM transactions AS znob
    WHERE znob.type = bev.type
);


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

SELECT salary FROM managers AS hac
WHERE salary > (
    SELECT COUNT(salary) FROM transactions AS xnob
    WHERE xnob.type = hac.type
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS znob
    WHERE znob.type = xnob.type
);


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

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


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

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


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

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


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

SELECT amount FROM departments AS dov
WHERE status IN (
    SELECT status FROM staff AS bev
    WHERE bev.id = dov.id
);


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

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


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

SELECT amount FROM staff AS xnob
WHERE salary > (
    SELECT SUM(salary) FROM managers AS jac
    WHERE jac.type = xnob.type
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS ejof
    WHERE ejof.type = vnob.type
);


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

SELECT id FROM shipments AS vnob
WHERE value > (
    SELECT COUNT(amount) FROM products AS nad
    WHERE nad.status = vnob.status
);


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

SELECT salary FROM tasks AS znob
WHERE status IN (
    SELECT status FROM categories AS bev
    WHERE bev.code = znob.code
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM customers AS ikob
    WHERE ikob.level = okiv.level
);


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

SELECT value FROM invoices AS fal
WHERE amount > (
    SELECT SUM(amount) FROM sales AS ikob
    WHERE ikob.level = fal.level
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM sales AS ikob
    WHERE ikob.level = ejof.level
);


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

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


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

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


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

SELECT code FROM departments AS dov
WHERE code IN (
    SELECT code FROM sales AS vnob
    WHERE vnob.code = dov.code
);


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

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


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

SELECT name FROM categories AS egiv
WHERE value > (
    SELECT SUM(amount) FROM requests AS okiv
    WHERE okiv.level = egiv.level
);


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

SELECT id FROM transactions AS gev
WHERE value > (
    SELECT MAX(amount) FROM requests AS jac
    WHERE jac.type = gev.type
);


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

SELECT id FROM employees AS bev
WHERE salary > (
    SELECT MIN(salary) FROM invoices AS nad
    WHERE nad.status = bev.status
);


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

SELECT id FROM products AS nad
WHERE salary > (
    SELECT MAX(amount) FROM invoices AS fal
    WHERE fal.id = nad.id
);


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

SELECT id FROM regions AS okiv
WHERE id IN (
    SELECT id FROM customers AS vmob
    WHERE vmob.type = okiv.type
);


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

SELECT value FROM items AS ikob
WHERE status IN (
    SELECT status FROM branches AS hac
    WHERE hac.status = ikob.status
);


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

SELECT code FROM accounts AS jac
WHERE salary > (
    SELECT MAX(value) FROM staff AS lex
    WHERE lex.id = jac.id
);


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

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


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

SELECT salary FROM categories AS egiv
WHERE salary > (
    SELECT AVG(salary) FROM regions AS dov
    WHERE dov.level = egiv.level
);


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

SELECT id FROM accounts AS jac
WHERE salary > (
    SELECT COUNT(amount) FROM employees AS nad
    WHERE nad.level = jac.level
);


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

SELECT amount FROM items AS ikob
WHERE id IN (
    SELECT id FROM projects AS uliv
    WHERE uliv.id = ikob.id
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.id = gev.id
);


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

SELECT amount FROM customers AS lex
WHERE amount > (
    SELECT MAX(value) FROM sales AS fal
    WHERE fal.status = lex.status
);


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

SELECT name FROM staff AS xnob
WHERE value > (
    SELECT MIN(value) FROM regions AS gev
    WHERE gev.type = xnob.type
);


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

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


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM sales AS vmob
    WHERE vmob.id = kab.id
);


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT SUM(amount) FROM invoices AS egiv
    WHERE egiv.status = agov.status
);


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

SELECT salary FROM invoices AS fal
WHERE type IN (
    SELECT type FROM transactions AS nad
    WHERE nad.status = fal.status
);


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

SELECT name FROM staff AS xnob
WHERE salary > (
    SELECT MIN(amount) FROM customers AS znob
    WHERE znob.status = xnob.status
);


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM orders AS okiv
    WHERE okiv.code = uliv.code
);


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

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


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

SELECT salary FROM orders AS kab
WHERE amount > (
    SELECT COUNT(salary) FROM regions AS nad
    WHERE nad.level = kab.level
);


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

SELECT code FROM shipments AS vnob
WHERE amount > (
    SELECT COUNT(value) FROM tasks AS gev
    WHERE gev.type = vnob.type
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM shipments AS ikob
    WHERE ikob.type = bev.type
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM customers AS nad
    WHERE nad.status = fal.status
);


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

SELECT value FROM shipments AS vnob
WHERE salary > (
    SELECT MIN(salary) FROM employees AS nad
    WHERE nad.level = vnob.level
);


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

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


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

SELECT id FROM items AS ikob
WHERE level IN (
    SELECT level FROM products AS uliv
    WHERE uliv.type = ikob.type
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM managers AS okiv
    WHERE okiv.id = nad.id
);


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

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


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS znob
    WHERE znob.type = vnob.type
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS xnob
    WHERE xnob.id = okiv.id
);


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

SELECT amount FROM managers AS hac
WHERE code IN (
    SELECT code FROM requests AS bev
    WHERE bev.type = hac.type
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM staff AS gev
    WHERE gev.type = bev.type
);


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

SELECT salary FROM shipments AS vnob
WHERE status IN (
    SELECT status FROM regions AS xnob
    WHERE xnob.level = vnob.level
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM staff AS jac
    WHERE jac.code = gev.code
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.type = vnob.type
);


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

SELECT id FROM departments AS dov
WHERE type IN (
    SELECT type FROM projects AS ejof
    WHERE ejof.status = dov.status
);


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

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


Prompt:
Schema:
  departments (alias: dov)(code, name, id, status)
  categories(salary, code, level, value)
Task: Find code from departments where value exceeds the minimum value from categories for the same id.
SQL:

SELECT code FROM departments AS dov
WHERE value > (
    SELECT MIN(value) FROM categories AS vnob
    WHERE vnob.id = dov.id
);


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

SELECT code FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM items AS ejof
    WHERE ejof.level = dov.level
);


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

SELECT code FROM items AS ikob
WHERE salary > (
    SELECT MAX(value) FROM departments AS jac
    WHERE jac.type = ikob.type
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE code IN (
    SELECT code FROM products AS gev
    WHERE gev.level = fal.level
);


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

SELECT salary FROM orders AS kab
WHERE value > (
    SELECT SUM(value) FROM shipments AS egiv
    WHERE egiv.id = kab.id
);


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

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


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

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


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

SELECT id FROM departments AS dov
WHERE salary > (
    SELECT MIN(salary) FROM transactions AS okiv
    WHERE okiv.code = dov.code
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM projects AS okiv
    WHERE okiv.id = bev.id
);


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

SELECT value FROM branches AS agov
WHERE value > (
    SELECT MIN(value) FROM accounts AS uliv
    WHERE uliv.id = agov.id
);


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

SELECT amount FROM departments AS dov
WHERE salary > (
    SELECT SUM(value) FROM requests AS egiv
    WHERE egiv.status = dov.status
);


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

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


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT SUM(amount) FROM schedules AS bev
    WHERE bev.type = agov.type
);


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

SELECT id FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM products AS kab
    WHERE kab.code = vnob.code
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM branches AS cif
    WHERE cif.code = znob.code
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM orders AS okiv
    WHERE okiv.type = agov.type
);


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

SELECT id FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.status = kab.status
);


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

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


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM requests AS jac
    WHERE jac.type = znob.type
);


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM products AS lex
    WHERE lex.type = uliv.type
);


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

SELECT salary FROM regions AS okiv
WHERE type IN (
    SELECT type FROM branches AS znob
    WHERE znob.status = okiv.status
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM accounts AS vmob
    WHERE vmob.code = bev.code
);


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

SELECT id FROM customers AS lex
WHERE amount > (
    SELECT AVG(value) FROM orders AS gev
    WHERE gev.level = lex.level
);


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

SELECT amount FROM customers AS lex
WHERE salary > (
    SELECT MAX(value) FROM invoices AS znob
    WHERE znob.type = lex.type
);


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

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


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

SELECT value FROM projects AS uliv
WHERE id IN (
    SELECT id FROM schedules AS xnob
    WHERE xnob.status = uliv.status
);


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

SELECT name FROM projects AS uliv
WHERE amount > (
    SELECT COUNT(amount) FROM departments AS jac
    WHERE jac.code = uliv.code
);


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

SELECT salary FROM projects AS uliv
WHERE code IN (
    SELECT code FROM orders AS vmob
    WHERE vmob.id = uliv.id
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM orders AS ikob
    WHERE ikob.code = egiv.code
);


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM orders AS xnob
    WHERE xnob.type = ikob.type
);


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

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


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM tasks AS bev
    WHERE bev.level = nad.level
);


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

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


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT AVG(salary) FROM transactions AS hac
    WHERE hac.id = dov.id
);


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

SELECT id FROM customers AS lex
WHERE type IN (
    SELECT type FROM managers AS agov
    WHERE agov.type = lex.type
);


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

SELECT code FROM branches AS agov
WHERE status IN (
    SELECT status FROM categories AS xnob
    WHERE xnob.id = agov.id
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM managers AS uliv
    WHERE uliv.id = fal.id
);


Prompt:
Schema:
  customers (alias: lex)(salary, name, level, type)
  branches(level, id, date, status)
Task: Find value from customers where value exceeds the count of value from branches for the same type.
SQL:

SELECT value FROM customers AS lex
WHERE value > (
    SELECT COUNT(value) FROM branches AS hac
    WHERE hac.type = lex.type
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS nad
    WHERE nad.level = vnob.level
);


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

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


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM products AS hac
    WHERE hac.id = vmob.id
);


Prompt:
Schema:
  items (alias: ikob)(status, salary, level, code)
  categories(status, salary, name, level)
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 vmob
    WHERE vmob.type = ikob.type
);


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

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


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM managers AS cif
    WHERE cif.type = kab.type
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE salary > (
    SELECT MIN(value) FROM tasks AS okiv
    WHERE okiv.id = xnob.id
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM regions AS agov
    WHERE agov.code = ejof.code
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM regions AS bev
    WHERE bev.status = vmob.status
);


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

SELECT value FROM departments AS dov
WHERE type IN (
    SELECT type FROM transactions AS znob
    WHERE znob.id = dov.id
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM schedules AS cif
    WHERE cif.status = bev.status
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM sales AS fal
    WHERE fal.id = hac.id
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM categories AS hac
    WHERE hac.id = fal.id
);


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

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


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

SELECT name FROM products AS nad
WHERE salary > (
    SELECT MAX(amount) FROM customers AS znob
    WHERE znob.type = nad.type
);


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

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


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

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT AVG(value) FROM items AS egiv
    WHERE egiv.code = ejof.code
);


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

SELECT amount FROM accounts AS jac
WHERE salary > (
    SELECT MIN(amount) FROM sales AS egiv
    WHERE egiv.level = jac.level
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM projects AS kab
    WHERE kab.id = vnob.id
);