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

SELECT salary FROM projects AS uliv
WHERE type IN (
    SELECT type FROM requests AS ejof
    WHERE ejof.id = uliv.id
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.level = ejof.level
);


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

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


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.code = vmob.code
);


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.level = cif.level
);


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

SELECT amount FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.type = znob.type
);


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

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


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.code = vmob.code
);


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

SELECT amount FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM categories AS egiv
    WHERE egiv.code = vnob.code
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.level = dov.level
);


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

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


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

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


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.code = egiv.code
);


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

SELECT salary FROM employees AS bev
WHERE id IN (
    SELECT id FROM categories AS egiv
    WHERE egiv.code = bev.code
);


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

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


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

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


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

SELECT amount FROM schedules AS vmob
WHERE salary > (
    SELECT AVG(value) FROM departments AS dov
    WHERE dov.id = vmob.id
);


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

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


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

SELECT amount FROM managers AS hac
WHERE code IN (
    SELECT code FROM regions AS okiv
    WHERE okiv.level = hac.level
);


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

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


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

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


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

SELECT value FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.type = xnob.type
);


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

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


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.type = bev.type
);


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

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


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

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


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

SELECT name FROM orders AS kab
WHERE id IN (
    SELECT id FROM departments AS dov
    WHERE dov.code = kab.code
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.status = lex.status
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.code = vnob.code
);


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

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


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

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


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

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


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM invoices AS fal
    WHERE fal.type = ikob.type
);


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

SELECT value FROM items AS ikob
WHERE code IN (
    SELECT code FROM managers AS hac
    WHERE hac.type = ikob.type
);


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

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


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

SELECT id FROM sales AS cif
WHERE amount > (
    SELECT SUM(salary) FROM transactions AS gev
    WHERE gev.status = cif.status
);


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

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


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.id = egiv.id
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM items AS ikob
    WHERE ikob.code = hac.code
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM orders AS kab
    WHERE kab.level = ejof.level
);


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

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


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.level = znob.level
);