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

SELECT id FROM accounts AS jac
WHERE type IN (
    SELECT type FROM sales AS lex
    WHERE lex.id = jac.id
);


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

SELECT value FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS bev
    WHERE bev.type = egiv.type
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM products AS hac
    WHERE hac.code = agov.code
);


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

SELECT id FROM managers AS hac
WHERE value > (
    SELECT COUNT(value) FROM items AS dov
    WHERE dov.status = hac.status
);


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

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


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM items AS vmob
    WHERE vmob.code = hac.code
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM categories AS jac
    WHERE jac.level = gev.level
);


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

SELECT value FROM departments AS dov
WHERE salary > (
    SELECT SUM(amount) FROM items AS uliv
    WHERE uliv.id = dov.id
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM shipments AS okiv
    WHERE okiv.status = cif.status
);


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

SELECT id FROM tasks AS znob
WHERE level IN (
    SELECT level FROM regions AS nad
    WHERE nad.type = znob.type
);


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

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


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

SELECT amount FROM shipments AS vnob
WHERE amount > (
    SELECT COUNT(salary) FROM invoices AS kab
    WHERE kab.id = vnob.id
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM tasks AS gev
    WHERE gev.status = ikob.status
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.code = nad.code
);


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

SELECT name FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM tasks AS ikob
    WHERE ikob.status = jac.status
);


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

SELECT salary FROM regions AS okiv
WHERE value > (
    SELECT MAX(amount) FROM managers AS znob
    WHERE znob.type = okiv.type
);


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

SELECT id FROM products AS nad
WHERE amount > (
    SELECT SUM(amount) FROM departments AS egiv
    WHERE egiv.type = nad.type
);


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

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


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

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


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

SELECT salary FROM orders AS kab
WHERE status IN (
    SELECT status FROM transactions AS znob
    WHERE znob.level = kab.level
);


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

SELECT name FROM projects AS uliv
WHERE id IN (
    SELECT id FROM requests AS vnob
    WHERE vnob.type = uliv.type
);


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

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


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

SELECT id FROM tasks AS znob
WHERE type IN (
    SELECT type FROM managers AS okiv
    WHERE okiv.type = znob.type
);


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT AVG(value) FROM employees AS kab
    WHERE kab.level = dov.level
);


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

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


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

SELECT value FROM customers AS lex
WHERE type IN (
    SELECT type FROM departments AS xnob
    WHERE xnob.level = lex.level
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM regions AS ejof
    WHERE ejof.level = gev.level
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM staff AS gev
    WHERE gev.id = nad.id
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM invoices AS dov
    WHERE dov.level = nad.level
);


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

SELECT id FROM products AS nad
WHERE status IN (
    SELECT status FROM items AS hac
    WHERE hac.code = nad.code
);


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

SELECT code FROM staff AS xnob
WHERE amount > (
    SELECT AVG(amount) FROM invoices AS lex
    WHERE lex.type = xnob.type
);


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

SELECT salary FROM requests AS ejof
WHERE id IN (
    SELECT id FROM orders AS bev
    WHERE bev.code = ejof.code
);


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM accounts AS znob
    WHERE znob.code = agov.code
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS egiv
    WHERE egiv.id = xnob.id
);


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

SELECT value FROM projects AS uliv
WHERE salary > (
    SELECT AVG(value) FROM items AS jac
    WHERE jac.id = uliv.id
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS dov
    WHERE dov.level = lex.level
);


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

SELECT code FROM shipments AS vnob
WHERE salary > (
    SELECT MAX(value) FROM sales AS okiv
    WHERE okiv.code = vnob.code
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM tasks AS dov
    WHERE dov.level = uliv.level
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM shipments AS hac
    WHERE hac.level = gev.level
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM managers AS lex
    WHERE lex.type = okiv.type
);


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

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


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

SELECT salary FROM customers AS lex
WHERE amount > (
    SELECT MAX(salary) FROM departments AS dov
    WHERE dov.level = lex.level
);


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

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


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

SELECT value FROM categories AS egiv
WHERE value > (
    SELECT MIN(value) FROM branches AS lex
    WHERE lex.status = egiv.status
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM accounts AS hac
    WHERE hac.status = xnob.status
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM categories AS uliv
    WHERE uliv.status = nad.status
);


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

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


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

SELECT code FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM projects AS kab
    WHERE kab.type = vnob.type
);


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

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


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

SELECT value FROM projects AS uliv
WHERE level IN (
    SELECT level FROM employees AS okiv
    WHERE okiv.code = uliv.code
);


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

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


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

SELECT code FROM staff AS xnob
WHERE id IN (
    SELECT id FROM schedules AS okiv
    WHERE okiv.level = xnob.level
);


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

SELECT id FROM categories AS egiv
WHERE amount > (
    SELECT COUNT(value) FROM invoices AS cif
    WHERE cif.level = egiv.level
);


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

SELECT salary FROM categories AS egiv
WHERE value > (
    SELECT COUNT(value) FROM sales AS hac
    WHERE hac.code = egiv.code
);


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

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


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT COUNT(salary) FROM shipments AS nad
    WHERE nad.type = bev.type
);


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

SELECT salary FROM regions AS okiv
WHERE amount > (
    SELECT MIN(salary) FROM requests AS vmob
    WHERE vmob.status = okiv.status
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM managers AS bev
    WHERE bev.id = egiv.id
);


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

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


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM regions AS jac
    WHERE jac.level = bev.level
);


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

SELECT name FROM products AS nad
WHERE salary > (
    SELECT COUNT(amount) FROM sales AS uliv
    WHERE uliv.type = nad.type
);


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

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


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

SELECT value FROM managers AS hac
WHERE id IN (
    SELECT id FROM accounts AS vmob
    WHERE vmob.type = hac.type
);


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

SELECT name FROM shipments AS vnob
WHERE value > (
    SELECT MIN(value) FROM employees AS gev
    WHERE gev.type = vnob.type
);


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

SELECT amount FROM invoices AS fal
WHERE amount > (
    SELECT MAX(amount) FROM categories AS vmob
    WHERE vmob.code = fal.code
);


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

SELECT code FROM items AS ikob
WHERE value > (
    SELECT MAX(amount) FROM sales AS vnob
    WHERE vnob.type = ikob.type
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM regions AS vnob
    WHERE vnob.code = vmob.code
);


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

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


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS uliv
    WHERE uliv.type = ejof.type
);


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

SELECT value FROM employees AS bev
WHERE type IN (
    SELECT type FROM items AS ejof
    WHERE ejof.status = bev.status
);


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

SELECT value FROM categories AS egiv
WHERE status IN (
    SELECT status FROM regions AS vmob
    WHERE vmob.code = egiv.code
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM employees AS gev
    WHERE gev.code = uliv.code
);


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

SELECT amount FROM requests AS ejof
WHERE value > (
    SELECT MAX(value) FROM managers AS gev
    WHERE gev.level = ejof.level
);


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

SELECT id FROM requests AS ejof
WHERE status IN (
    SELECT status FROM customers AS xnob
    WHERE xnob.status = ejof.status
);


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

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


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.level = znob.level
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM projects AS agov
    WHERE agov.type = gev.type
);


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

SELECT value FROM sales AS cif
WHERE amount > (
    SELECT COUNT(value) FROM products AS xnob
    WHERE xnob.code = cif.code
);


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

SELECT name FROM accounts AS jac
WHERE status IN (
    SELECT status FROM employees AS agov
    WHERE agov.status = jac.status
);


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

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


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.status = agov.status
);


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

SELECT id FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM customers AS xnob
    WHERE xnob.status = hac.status
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM customers AS vmob
    WHERE vmob.type = dov.type
);


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

SELECT value FROM customers AS lex
WHERE id IN (
    SELECT id FROM branches AS dov
    WHERE dov.id = lex.id
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM accounts AS dov
    WHERE dov.status = nad.status
);


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

SELECT id FROM requests AS ejof
WHERE amount > (
    SELECT SUM(amount) FROM items AS vmob
    WHERE vmob.id = ejof.id
);


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

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


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

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


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

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


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

SELECT salary FROM sales AS cif
WHERE level IN (
    SELECT level FROM branches AS agov
    WHERE agov.type = cif.type
);


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

SELECT value FROM items AS ikob
WHERE id IN (
    SELECT id FROM employees AS xnob
    WHERE xnob.type = ikob.type
);


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

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


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM shipments AS okiv
    WHERE okiv.id = znob.id
);


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

SELECT salary FROM invoices AS fal
WHERE code IN (
    SELECT code FROM managers AS nad
    WHERE nad.level = fal.level
);


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

SELECT name FROM categories AS egiv
WHERE value > (
    SELECT MIN(amount) FROM branches AS bev
    WHERE bev.level = egiv.level
);


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

SELECT amount FROM staff AS xnob
WHERE level IN (
    SELECT level FROM branches AS ikob
    WHERE ikob.code = xnob.code
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM invoices AS hac
    WHERE hac.code = kab.code
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.id = kab.id
);


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

SELECT amount FROM shipments AS vnob
WHERE salary > (
    SELECT SUM(salary) FROM invoices AS fal
    WHERE fal.type = vnob.type
);


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM projects AS okiv
    WHERE okiv.code = hac.code
);


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

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


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

SELECT value FROM items AS ikob
WHERE salary > (
    SELECT COUNT(amount) FROM invoices AS cif
    WHERE cif.code = ikob.code
);


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

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


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

SELECT name FROM departments AS dov
WHERE status IN (
    SELECT status FROM invoices AS okiv
    WHERE okiv.id = dov.id
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM customers AS ejof
    WHERE ejof.code = agov.code
);


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

SELECT id FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM managers AS agov
    WHERE agov.status = egiv.status
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM customers AS cif
    WHERE cif.id = vmob.id
);


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

SELECT code FROM customers AS lex
WHERE level IN (
    SELECT level FROM orders AS fal
    WHERE fal.id = lex.id
);


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

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


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

SELECT value FROM transactions AS gev
WHERE status IN (
    SELECT status FROM shipments AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT salary FROM accounts AS jac
WHERE level IN (
    SELECT level FROM managers AS okiv
    WHERE okiv.status = jac.status
);


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

SELECT name FROM employees AS bev
WHERE type IN (
    SELECT type FROM categories AS ejof
    WHERE ejof.id = bev.id
);


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

SELECT code FROM accounts AS jac
WHERE amount > (
    SELECT AVG(salary) FROM departments AS lex
    WHERE lex.code = jac.code
);


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

SELECT id FROM projects AS uliv
WHERE code IN (
    SELECT code FROM requests AS agov
    WHERE agov.level = uliv.level
);


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

SELECT amount FROM sales AS cif
WHERE status IN (
    SELECT status FROM projects AS nad
    WHERE nad.code = cif.code
);


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

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


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

SELECT id FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM sales AS uliv
    WHERE uliv.code = znob.code
);


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

SELECT amount FROM managers AS hac
WHERE status IN (
    SELECT status FROM employees AS xnob
    WHERE xnob.status = hac.status
);


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

SELECT id FROM regions AS okiv
WHERE status IN (
    SELECT status FROM requests AS cif
    WHERE cif.code = okiv.code
);


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM accounts AS znob
    WHERE znob.status = vmob.status
);


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM staff AS gev
    WHERE gev.status = kab.status
);


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

SELECT salary FROM products AS nad
WHERE status IN (
    SELECT status FROM shipments AS okiv
    WHERE okiv.id = nad.id
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM requests AS jac
    WHERE jac.id = lex.id
);


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

SELECT amount FROM managers AS hac
WHERE id IN (
    SELECT id FROM tasks AS xnob
    WHERE xnob.level = hac.level
);


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

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


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

SELECT salary FROM schedules AS vmob
WHERE value > (
    SELECT AVG(value) FROM categories AS jac
    WHERE jac.level = vmob.level
);


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

SELECT id FROM orders AS kab
WHERE code IN (
    SELECT code FROM accounts AS agov
    WHERE agov.level = kab.level
);


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

SELECT amount FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM sales AS gev
    WHERE gev.status = vnob.status
);


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

SELECT id FROM orders AS kab
WHERE amount > (
    SELECT COUNT(amount) FROM branches AS fal
    WHERE fal.type = kab.type
);


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

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


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

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


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

SELECT id FROM orders AS kab
WHERE value > (
    SELECT SUM(amount) FROM accounts AS lex
    WHERE lex.level = kab.level
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM invoices AS cif
    WHERE cif.level = agov.level
);


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

SELECT name FROM items AS ikob
WHERE type IN (
    SELECT type FROM categories AS jac
    WHERE jac.type = ikob.type
);


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT SUM(salary) FROM transactions AS vnob
    WHERE vnob.code = agov.code
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM regions AS fal
    WHERE fal.type = nad.type
);


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

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


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM customers AS ejof
    WHERE ejof.type = vmob.type
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM managers AS vnob
    WHERE vnob.status = cif.status
);


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

SELECT salary FROM items AS ikob
WHERE salary > (
    SELECT MIN(amount) FROM invoices AS gev
    WHERE gev.id = ikob.id
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM accounts AS xnob
    WHERE xnob.level = ikob.level
);


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

SELECT code FROM tasks AS znob
WHERE level IN (
    SELECT level FROM categories AS egiv
    WHERE egiv.code = znob.code
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM categories AS cif
    WHERE cif.status = jac.status
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM accounts AS fal
    WHERE fal.status = okiv.status
);


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

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


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM managers AS vnob
    WHERE vnob.code = kab.code
);


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

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


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

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


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

SELECT value FROM departments AS dov
WHERE salary > (
    SELECT SUM(salary) FROM customers AS xnob
    WHERE xnob.id = dov.id
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM items AS ejof
    WHERE ejof.type = gev.type
);


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

SELECT name FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM shipments AS xnob
    WHERE xnob.status = vmob.status
);


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

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


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

SELECT name FROM products AS nad
WHERE value > (
    SELECT COUNT(value) FROM projects AS dov
    WHERE dov.level = nad.level
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT AVG(salary) FROM managers AS cif
    WHERE cif.code = kab.code
);


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

SELECT value FROM requests AS ejof
WHERE status IN (
    SELECT status FROM projects AS nad
    WHERE nad.level = ejof.level
);


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM departments AS jac
    WHERE jac.code = znob.code
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT SUM(amount) FROM branches AS nad
    WHERE nad.code = okiv.code
);


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

SELECT amount FROM managers AS hac
WHERE code IN (
    SELECT code FROM orders AS egiv
    WHERE egiv.code = hac.code
);


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

SELECT code FROM regions AS okiv
WHERE amount > (
    SELECT SUM(value) FROM departments AS jac
    WHERE jac.id = okiv.id
);


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM products AS dov
    WHERE dov.code = hac.code
);


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

SELECT amount FROM customers AS lex
WHERE id IN (
    SELECT id FROM staff AS xnob
    WHERE xnob.id = lex.id
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM items AS jac
    WHERE jac.id = hac.id
);


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

SELECT id FROM items AS ikob
WHERE amount > (
    SELECT SUM(value) FROM departments AS lex
    WHERE lex.id = ikob.id
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.type = dov.type
);


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

SELECT id FROM customers AS lex
WHERE value > (
    SELECT AVG(salary) FROM branches AS okiv
    WHERE okiv.id = lex.id
);


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

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


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT MIN(value) FROM customers AS xnob
    WHERE xnob.type = agov.type
);


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

SELECT code FROM staff AS xnob
WHERE code IN (
    SELECT code FROM projects AS vnob
    WHERE vnob.level = xnob.level
);


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

SELECT amount FROM orders AS kab
WHERE level IN (
    SELECT level FROM staff AS bev
    WHERE bev.id = kab.id
);


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

SELECT amount FROM orders AS kab
WHERE level IN (
    SELECT level FROM schedules AS ikob
    WHERE ikob.type = kab.type
);


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

SELECT id FROM products AS nad
WHERE level IN (
    SELECT level FROM regions AS vnob
    WHERE vnob.status = nad.status
);


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

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


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

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


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM projects AS jac
    WHERE jac.code = cif.code
);


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

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


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

SELECT value FROM regions AS okiv
WHERE value > (
    SELECT MIN(value) FROM employees AS egiv
    WHERE egiv.level = okiv.level
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM managers AS egiv
    WHERE egiv.type = kab.type
);


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

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


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

SELECT value FROM accounts AS jac
WHERE status IN (
    SELECT status FROM orders AS gev
    WHERE gev.status = jac.status
);


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

SELECT code FROM products AS nad
WHERE code IN (
    SELECT code FROM orders AS okiv
    WHERE okiv.type = nad.type
);


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

SELECT salary FROM projects AS uliv
WHERE salary > (
    SELECT AVG(value) FROM items AS fal
    WHERE fal.code = uliv.code
);


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

SELECT code FROM sales AS cif
WHERE level IN (
    SELECT level FROM accounts AS egiv
    WHERE egiv.status = cif.status
);


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

SELECT code FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM accounts AS ejof
    WHERE ejof.level = hac.level
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM branches AS okiv
    WHERE okiv.code = fal.code
);


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

SELECT salary FROM schedules AS vmob
WHERE salary > (
    SELECT MIN(amount) FROM sales AS ikob
    WHERE ikob.code = vmob.code
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM schedules AS egiv
    WHERE egiv.status = ejof.status
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM items AS hac
    WHERE hac.code = uliv.code
);


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

SELECT amount FROM sales AS cif
WHERE salary > (
    SELECT COUNT(amount) FROM schedules AS dov
    WHERE dov.status = cif.status
);


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

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


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

SELECT id FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM categories AS dov
    WHERE dov.id = vnob.id
);


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

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


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

SELECT code FROM items AS ikob
WHERE value > (
    SELECT MAX(value) FROM transactions AS nad
    WHERE nad.level = ikob.level
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM employees AS uliv
    WHERE uliv.code = nad.code
);


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

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


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM invoices AS uliv
    WHERE uliv.code = jac.code
);


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

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


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM accounts AS hac
    WHERE hac.code = vmob.code
);


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

SELECT name FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(value) FROM invoices AS egiv
    WHERE egiv.level = znob.level
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM departments AS gev
    WHERE gev.id = hac.id
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM invoices AS vmob
    WHERE vmob.type = egiv.type
);


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM categories AS agov
    WHERE agov.level = jac.level
);


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

SELECT code FROM accounts AS jac
WHERE level IN (
    SELECT level FROM tasks AS gev
    WHERE gev.type = jac.type
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM schedules AS gev
    WHERE gev.id = cif.id
);


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

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT MIN(amount) FROM sales AS agov
    WHERE agov.id = vmob.id
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM staff AS ikob
    WHERE ikob.type = vmob.type
);


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

SELECT value FROM orders AS kab
WHERE id IN (
    SELECT id FROM categories AS nad
    WHERE nad.status = kab.status
);


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM sales AS egiv
    WHERE egiv.code = ejof.code
);


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

SELECT value FROM branches AS agov
WHERE value > (
    SELECT SUM(salary) FROM customers AS znob
    WHERE znob.type = agov.type
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM accounts AS bev
    WHERE bev.level = ikob.level
);


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

SELECT amount FROM managers AS hac
WHERE value > (
    SELECT AVG(value) FROM schedules AS ejof
    WHERE ejof.code = hac.code
);


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

SELECT code FROM accounts AS jac
WHERE id IN (
    SELECT id FROM categories AS fal
    WHERE fal.level = jac.level
);


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT AVG(amount) FROM shipments AS dov
    WHERE dov.type = cif.type
);


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

SELECT salary FROM orders AS kab
WHERE amount > (
    SELECT SUM(salary) FROM invoices AS vnob
    WHERE vnob.status = kab.status
);


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

SELECT salary FROM projects AS uliv
WHERE salary > (
    SELECT COUNT(amount) FROM tasks AS jac
    WHERE jac.type = uliv.type
);


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

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


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM products AS lex
    WHERE lex.type = agov.type
);


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

SELECT amount FROM accounts AS jac
WHERE id IN (
    SELECT id FROM customers AS ikob
    WHERE ikob.type = jac.type
);


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

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


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

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


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

SELECT id FROM requests AS ejof
WHERE level IN (
    SELECT level FROM products AS jac
    WHERE jac.id = ejof.id
);


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

SELECT name FROM managers AS hac
WHERE code IN (
    SELECT code FROM branches AS dov
    WHERE dov.level = hac.level
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM requests AS nad
    WHERE nad.code = vnob.code
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT SUM(amount) FROM departments AS dov
    WHERE dov.code = okiv.code
);


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

SELECT value FROM tasks AS znob
WHERE salary > (
    SELECT MAX(salary) FROM schedules AS dov
    WHERE dov.code = znob.code
);


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

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


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM transactions AS lex
    WHERE lex.type = uliv.type
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM accounts AS znob
    WHERE znob.status = fal.status
);


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

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


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM projects AS jac
    WHERE jac.id = lex.id
);


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

SELECT amount FROM schedules AS vmob
WHERE value > (
    SELECT MAX(salary) FROM customers AS ejof
    WHERE ejof.type = vmob.type
);


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

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


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM transactions AS agov
    WHERE agov.type = ejof.type
);


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT COUNT(amount) FROM categories AS uliv
    WHERE uliv.code = dov.code
);


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

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


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

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


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM invoices AS kab
    WHERE kab.id = bev.id
);


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

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


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT COUNT(value) FROM employees AS vnob
    WHERE vnob.code = fal.code
);


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

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


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM categories AS jac
    WHERE jac.code = ejof.code
);


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

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


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

SELECT salary FROM sales AS cif
WHERE salary > (
    SELECT COUNT(value) FROM invoices AS dov
    WHERE dov.type = cif.type
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS gev
    WHERE gev.code = xnob.code
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.id = okiv.id
);


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

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


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS agov
    WHERE agov.code = gev.code
);


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

SELECT salary FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM sales AS ikob
    WHERE ikob.id = vmob.id
);


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

SELECT salary FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM categories AS ejof
    WHERE ejof.code = vnob.code
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM requests AS egiv
    WHERE egiv.status = vnob.status
);


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

SELECT value FROM managers AS hac
WHERE type IN (
    SELECT type FROM products AS dov
    WHERE dov.level = hac.level
);


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

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


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

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


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

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


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

SELECT name FROM employees AS bev
WHERE id IN (
    SELECT id FROM requests AS cif
    WHERE cif.level = bev.level
);


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

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


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

SELECT id FROM departments AS dov
WHERE level IN (
    SELECT level FROM items AS okiv
    WHERE okiv.code = dov.code
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM requests AS cif
    WHERE cif.id = znob.id
);


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

SELECT code FROM requests AS ejof
WHERE amount > (
    SELECT SUM(value) FROM invoices AS ikob
    WHERE ikob.type = ejof.type
);


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

SELECT salary FROM shipments AS vnob
WHERE amount > (
    SELECT COUNT(amount) FROM requests AS kab
    WHERE kab.status = vnob.status
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.code = cif.code
);


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

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


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM employees AS hac
    WHERE hac.code = vnob.code
);


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT AVG(value) FROM schedules AS xnob
    WHERE xnob.code = dov.code
);


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

SELECT salary FROM regions AS okiv
WHERE id IN (
    SELECT id FROM tasks AS ikob
    WHERE ikob.level = okiv.level
);


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

SELECT salary FROM staff AS xnob
WHERE value > (
    SELECT COUNT(amount) FROM branches AS dov
    WHERE dov.code = xnob.code
);


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

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


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

SELECT value FROM shipments AS vnob
WHERE amount > (
    SELECT AVG(amount) FROM branches AS nad
    WHERE nad.type = vnob.type
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM projects AS hac
    WHERE hac.code = nad.code
);


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

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


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

SELECT code FROM invoices AS fal
WHERE type IN (
    SELECT type FROM categories AS okiv
    WHERE okiv.code = fal.code
);


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

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


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

SELECT code FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM orders AS dov
    WHERE dov.level = okiv.level
);


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

SELECT amount FROM sales AS cif
WHERE status IN (
    SELECT status FROM items AS kab
    WHERE kab.level = cif.level
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM shipments AS uliv
    WHERE uliv.level = cif.level
);


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

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


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

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


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

SELECT code FROM branches AS agov
WHERE amount > (
    SELECT AVG(salary) FROM products AS dov
    WHERE dov.level = agov.level
);


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

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


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

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


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

SELECT salary FROM items AS ikob
WHERE type IN (
    SELECT type FROM sales AS ejof
    WHERE ejof.id = ikob.id
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM items AS bev
    WHERE bev.level = cif.level
);


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

SELECT code FROM departments AS dov
WHERE salary > (
    SELECT AVG(value) FROM tasks AS xnob
    WHERE xnob.code = dov.code
);


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

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


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

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


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

SELECT name FROM orders AS kab
WHERE value > (
    SELECT COUNT(amount) FROM tasks AS nad
    WHERE nad.code = kab.code
);


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

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


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM branches AS vnob
    WHERE vnob.type = znob.type
);


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

SELECT amount FROM items AS ikob
WHERE amount > (
    SELECT MIN(salary) FROM projects AS gev
    WHERE gev.id = ikob.id
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM tasks AS xnob
    WHERE xnob.id = fal.id
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS hac
    WHERE hac.level = vnob.level
);


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

SELECT value FROM branches AS agov
WHERE status IN (
    SELECT status FROM shipments AS vnob
    WHERE vnob.level = agov.level
);


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

SELECT code FROM projects AS uliv
WHERE level IN (
    SELECT level FROM shipments AS cif
    WHERE cif.type = uliv.type
);


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

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


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

SELECT id FROM departments AS dov
WHERE salary > (
    SELECT AVG(amount) FROM shipments AS ejof
    WHERE ejof.status = dov.status
);


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

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


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM categories AS vnob
    WHERE vnob.level = vmob.level
);


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

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