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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT MAX(amount) FROM departments AS dov
    WHERE dov.type = fal.type
);


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

SELECT amount FROM employees AS bev
WHERE type IN (
    SELECT type FROM accounts AS jac
    WHERE jac.status = bev.status
);


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.id = vnob.id
);


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

SELECT id FROM departments AS dov
WHERE level IN (
    SELECT level FROM managers AS hac
    WHERE hac.type = dov.type
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.level = okiv.level
);


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

SELECT code FROM orders AS kab
WHERE amount > (
    SELECT SUM(salary) FROM items AS ikob
    WHERE ikob.type = kab.type
);


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

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


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

SELECT amount FROM employees AS bev
WHERE level IN (
    SELECT level FROM invoices AS fal
    WHERE fal.type = bev.type
);


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

SELECT value FROM products AS nad
WHERE status IN (
    SELECT status FROM employees AS bev
    WHERE bev.status = nad.status
);


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 type.
SQL:

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.type = xnob.type
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT code FROM departments AS dov
WHERE code IN (
    SELECT code FROM transactions AS gev
    WHERE gev.status = dov.status
);


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

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


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

SELECT code FROM regions AS okiv
WHERE amount > (
    SELECT COUNT(value) FROM orders AS kab
    WHERE kab.level = okiv.level
);


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

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


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

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


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

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


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

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


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

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


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

SELECT salary FROM accounts AS jac
WHERE code IN (
    SELECT code FROM transactions AS gev
    WHERE gev.id = jac.id
);


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

SELECT value FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM departments AS dov
    WHERE dov.id = vmob.id
);


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

SELECT name FROM invoices AS fal
WHERE amount > (
    SELECT AVG(amount) FROM managers AS hac
    WHERE hac.type = fal.type
);


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

SELECT amount FROM sales AS cif
WHERE status IN (
    SELECT status FROM departments AS dov
    WHERE dov.code = cif.code
);


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

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


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

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


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

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


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

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


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.level = egiv.level
);


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

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


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

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


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

SELECT code FROM products AS nad
WHERE salary > (
    SELECT MAX(value) FROM orders AS kab
    WHERE kab.code = nad.code
);


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

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


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM shipments AS vnob
    WHERE vnob.type = lex.type
);


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

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


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

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


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

SELECT value FROM managers AS hac
WHERE value > (
    SELECT COUNT(amount) FROM schedules AS vmob
    WHERE vmob.id = hac.id
);


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

SELECT salary FROM schedules AS vmob
WHERE value > (
    SELECT MAX(amount) FROM invoices AS fal
    WHERE fal.level = vmob.level
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.level = ikob.level
);


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

SELECT amount FROM sales AS cif
WHERE type IN (
    SELECT type FROM products AS nad
    WHERE nad.code = cif.code
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM branches AS agov
    WHERE agov.id = hac.id
);


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

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


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

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


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.level = ikob.level
);


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

SELECT value FROM schedules AS vmob
WHERE salary > (
    SELECT COUNT(amount) FROM products AS nad
    WHERE nad.type = vmob.type
);


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

SELECT code FROM orders AS kab
WHERE level IN (
    SELECT level FROM sales AS cif
    WHERE cif.status = kab.status
);


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

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


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

SELECT id FROM managers AS hac
WHERE id IN (
    SELECT id FROM sales AS cif
    WHERE cif.id = hac.id
);


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

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


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

SELECT value FROM products AS nad
WHERE value > (
    SELECT SUM(amount) FROM items AS ikob
    WHERE ikob.level = nad.level
);


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

SELECT value FROM tasks AS znob
WHERE level IN (
    SELECT level FROM products AS nad
    WHERE nad.level = znob.level
);


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

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


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

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


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

SELECT salary FROM shipments AS vnob
WHERE salary > (
    SELECT MIN(salary) FROM categories AS egiv
    WHERE egiv.type = vnob.type
);


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

SELECT name FROM customers AS lex
WHERE salary > (
    SELECT AVG(salary) FROM invoices AS fal
    WHERE fal.status = lex.status
);


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

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


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.type = vnob.type
);


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

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


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT COUNT(salary) FROM employees AS bev
    WHERE bev.id = kab.id
);


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

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


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

SELECT code FROM regions AS okiv
WHERE value > (
    SELECT MIN(value) FROM schedules AS vmob
    WHERE vmob.type = okiv.type
);


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

SELECT id FROM tasks AS znob
WHERE level IN (
    SELECT level FROM orders AS kab
    WHERE kab.status = znob.status
);


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

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


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.type = okiv.type
);


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

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


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

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


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

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


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

SELECT name FROM orders AS kab
WHERE code IN (
    SELECT code FROM schedules AS vmob
    WHERE vmob.id = kab.id
);


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

SELECT amount FROM transactions AS gev
WHERE amount > (
    SELECT MIN(amount) FROM tasks AS znob
    WHERE znob.level = gev.level
);


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

SELECT name FROM managers AS hac
WHERE salary > (
    SELECT MIN(value) FROM projects AS uliv
    WHERE uliv.id = hac.id
);


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

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


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

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


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

SELECT code FROM employees AS bev
WHERE amount > (
    SELECT MAX(salary) FROM projects AS uliv
    WHERE uliv.type = bev.type
);


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT MAX(value) FROM projects AS uliv
    WHERE uliv.status = znob.status
);


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

SELECT amount FROM transactions AS gev
WHERE id IN (
    SELECT id FROM requests AS ejof
    WHERE ejof.type = gev.type
);


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

SELECT amount FROM categories AS egiv
WHERE status IN (
    SELECT status FROM employees AS bev
    WHERE bev.level = egiv.level
);


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

SELECT name FROM employees AS bev
WHERE status IN (
    SELECT status FROM branches AS agov
    WHERE agov.code = bev.code
);


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

SELECT salary FROM employees AS bev
WHERE code IN (
    SELECT code FROM customers AS lex
    WHERE lex.type = bev.type
);


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

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


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT AVG(salary) FROM items AS ikob
    WHERE ikob.type = okiv.type
);


Prompt:
Schema:
  staff (alias: xnob)(status, salary, level, date)
  accounts(name, id, status, salary)
Task: Retrieve code from staff with salary above the MAX(salary) of accounts rows sharing the same id.
SQL:

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


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

SELECT value FROM departments AS dov
WHERE salary > (
    SELECT SUM(value) FROM regions AS okiv
    WHERE okiv.level = dov.level
);


Prompt:
Schema:
  invoices (alias: fal)(status, date, value, code)
  accounts(id, value, name, level)
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 jac
    WHERE jac.status = fal.status
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE id IN (
    SELECT id FROM transactions AS gev
    WHERE gev.type = fal.type
);


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

SELECT code FROM departments AS dov
WHERE amount > (
    SELECT COUNT(amount) FROM accounts AS jac
    WHERE jac.status = dov.status
);


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM shipments AS vnob
    WHERE vnob.code = uliv.code
);


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

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


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.id = nad.id
);


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

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


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.code = nad.code
);


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

SELECT amount FROM transactions AS gev
WHERE code IN (
    SELECT code FROM regions AS okiv
    WHERE okiv.status = gev.status
);


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

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


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

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


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

SELECT name FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM transactions AS gev
    WHERE gev.id = vnob.id
);


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

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


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

SELECT value FROM regions AS okiv
WHERE status IN (
    SELECT status FROM items AS ikob
    WHERE ikob.id = okiv.id
);


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

SELECT value FROM employees AS bev
WHERE salary > (
    SELECT MIN(amount) FROM tasks AS znob
    WHERE znob.level = bev.level
);


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

SELECT amount FROM branches AS agov
WHERE code IN (
    SELECT code FROM staff AS xnob
    WHERE xnob.id = agov.id
);


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

SELECT id FROM departments AS dov
WHERE level IN (
    SELECT level FROM tasks AS znob
    WHERE znob.id = dov.id
);


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

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


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

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


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

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


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.level = egiv.level
);


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

SELECT value FROM staff AS xnob
WHERE salary > (
    SELECT SUM(salary) FROM shipments AS vnob
    WHERE vnob.status = xnob.status
);


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

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


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

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


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

SELECT id FROM tasks AS znob
WHERE status IN (
    SELECT status FROM shipments AS vnob
    WHERE vnob.id = znob.id
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.type = xnob.type
);


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

SELECT value FROM branches AS agov
WHERE salary > (
    SELECT AVG(value) FROM items AS ikob
    WHERE ikob.type = agov.type
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM shipments AS vnob
    WHERE vnob.code = cif.code
);


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.type = vmob.type
);


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

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


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

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


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

SELECT name FROM orders AS kab
WHERE salary > (
    SELECT SUM(salary) FROM categories AS egiv
    WHERE egiv.status = kab.status
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM invoices AS fal
    WHERE fal.status = bev.status
);


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

SELECT name FROM projects AS uliv
WHERE value > (
    SELECT SUM(value) FROM invoices AS fal
    WHERE fal.id = uliv.id
);


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

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


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

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


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

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


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

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


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.id = nad.id
);


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

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


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

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


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

SELECT value FROM departments AS dov
WHERE id IN (
    SELECT id FROM employees AS bev
    WHERE bev.code = dov.code
);


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

SELECT id FROM departments AS dov
WHERE id IN (
    SELECT id FROM shipments AS vnob
    WHERE vnob.status = dov.status
);


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.type = egiv.type
);


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

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


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

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


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

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


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

SELECT amount FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM tasks AS znob
    WHERE znob.level = vmob.level
);


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

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


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

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


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

SELECT value FROM customers AS lex
WHERE code IN (
    SELECT code FROM managers AS hac
    WHERE hac.level = lex.level
);


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

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


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

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


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

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


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

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


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

SELECT code FROM customers AS lex
WHERE type IN (
    SELECT type FROM regions AS okiv
    WHERE okiv.code = lex.code
);


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

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


Prompt:
Schema:
  schedules (alias: vmob)(status, date, code, type)
  accounts(code, id, name, level)
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:
  staff (alias: xnob)(level, type, name, id)
  items(name, id, status, code)
Task: Retrieve name from staff that have at least one corresponding entry in items sharing the same code.
SQL:

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


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

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


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

SELECT value FROM orders AS kab
WHERE code IN (
    SELECT code FROM tasks AS znob
    WHERE znob.type = kab.type
);


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

SELECT name FROM products AS nad
WHERE code IN (
    SELECT code FROM accounts AS jac
    WHERE jac.type = nad.type
);


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

SELECT value FROM orders AS kab
WHERE type IN (
    SELECT type FROM invoices AS fal
    WHERE fal.status = kab.status
);


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

SELECT name FROM invoices AS fal
WHERE level IN (
    SELECT level FROM staff AS xnob
    WHERE xnob.code = fal.code
);


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

SELECT value FROM accounts AS jac
WHERE amount > (
    SELECT COUNT(value) FROM shipments AS vnob
    WHERE vnob.level = jac.level
);


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

SELECT name FROM requests AS ejof
WHERE salary > (
    SELECT MIN(value) FROM tasks AS znob
    WHERE znob.id = ejof.id
);


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

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


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

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


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

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


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

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


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.status = kab.status
);


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

SELECT amount FROM projects AS uliv
WHERE code IN (
    SELECT code FROM managers AS hac
    WHERE hac.id = uliv.id
);


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

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


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

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


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

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


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.status = uliv.status
);


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

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


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

SELECT id FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM projects AS uliv
    WHERE uliv.level = vmob.level
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.status = hac.status
);


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

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


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

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


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

SELECT id FROM shipments AS vnob
WHERE salary > (
    SELECT AVG(salary) FROM tasks AS znob
    WHERE znob.status = vnob.status
);


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

SELECT name FROM departments AS dov
WHERE code IN (
    SELECT code FROM invoices AS fal
    WHERE fal.status = dov.status
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.level = ejof.level
);


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

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


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

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


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

SELECT code FROM requests AS ejof
WHERE salary > (
    SELECT MAX(amount) FROM customers AS lex
    WHERE lex.type = ejof.type
);


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

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


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

SELECT amount FROM accounts AS jac
WHERE type IN (
    SELECT type FROM invoices AS fal
    WHERE fal.id = jac.id
);


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

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


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

SELECT name FROM invoices AS fal
WHERE type IN (
    SELECT type FROM orders AS kab
    WHERE kab.code = fal.code
);


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

SELECT code FROM transactions AS gev
WHERE id IN (
    SELECT id FROM departments AS dov
    WHERE dov.code = gev.code
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS fal
    WHERE fal.level = vnob.level
);


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

SELECT name FROM managers AS hac
WHERE salary > (
    SELECT SUM(amount) FROM requests AS ejof
    WHERE ejof.id = hac.id
);


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

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


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

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


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

SELECT value FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM products AS nad
    WHERE nad.code = vmob.code
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.status = uliv.status
);


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

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


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

SELECT id FROM regions AS okiv
WHERE value > (
    SELECT SUM(amount) FROM shipments AS vnob
    WHERE vnob.status = okiv.status
);


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

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


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

SELECT code FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM employees AS bev
    WHERE bev.type = vmob.type
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT AVG(value) FROM accounts AS jac
    WHERE jac.code = hac.code
);


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

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


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

SELECT salary FROM requests AS ejof
WHERE code IN (
    SELECT code FROM branches AS agov
    WHERE agov.level = ejof.level
);


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

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


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

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


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

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


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

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


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

SELECT code FROM branches AS agov
WHERE type IN (
    SELECT type FROM requests AS ejof
    WHERE ejof.status = agov.status
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.level = xnob.level
);


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

SELECT value FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM regions AS okiv
    WHERE okiv.code = vmob.code
);


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

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


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.type = nad.type
);


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

SELECT code FROM items AS ikob
WHERE amount > (
    SELECT MAX(amount) FROM employees AS bev
    WHERE bev.type = ikob.type
);


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

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


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

SELECT code FROM accounts AS jac
WHERE level IN (
    SELECT level FROM schedules AS vmob
    WHERE vmob.code = jac.code
);


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

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


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

SELECT amount FROM transactions AS gev
WHERE level IN (
    SELECT level FROM departments AS dov
    WHERE dov.type = gev.type
);


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

SELECT name FROM staff AS xnob
WHERE amount > (
    SELECT MAX(amount) FROM managers AS hac
    WHERE hac.type = xnob.type
);


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

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


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

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


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

SELECT name FROM categories AS egiv
WHERE id IN (
    SELECT id FROM schedules AS vmob
    WHERE vmob.status = egiv.status
);


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.code = bev.code
);


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

SELECT code FROM categories AS egiv
WHERE salary > (
    SELECT SUM(salary) FROM departments AS dov
    WHERE dov.code = egiv.code
);


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

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


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

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


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM accounts AS jac
    WHERE jac.code = cif.code
);


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

SELECT amount FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = kab.code
);


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

SELECT code FROM branches AS agov
WHERE value > (
    SELECT AVG(amount) FROM requests AS ejof
    WHERE ejof.code = agov.code
);


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

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


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.type = lex.type
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.level = lex.level
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.id = bev.id
);


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

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


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

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


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

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


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.level = xnob.level
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.level = kab.level
);


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

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


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

SELECT code FROM sales AS cif
WHERE value > (
    SELECT SUM(salary) FROM invoices AS fal
    WHERE fal.status = cif.status
);


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

SELECT value FROM staff AS xnob
WHERE salary > (
    SELECT MIN(value) FROM sales AS cif
    WHERE cif.level = xnob.level
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.id = uliv.id
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = kab.code
);


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

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


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM managers AS hac
    WHERE hac.id = lex.id
);


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

SELECT salary FROM tasks AS znob
WHERE type IN (
    SELECT type FROM orders AS kab
    WHERE kab.level = znob.level
);


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

SELECT code FROM items AS ikob
WHERE status IN (
    SELECT status FROM requests AS ejof
    WHERE ejof.type = ikob.type
);


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

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


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.type = vnob.type
);


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

SELECT amount FROM departments AS dov
WHERE amount > (
    SELECT MIN(amount) FROM items AS ikob
    WHERE ikob.status = dov.status
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.id = lex.id
);


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

SELECT value FROM categories AS egiv
WHERE level IN (
    SELECT level FROM transactions AS gev
    WHERE gev.code = egiv.code
);


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

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


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

SELECT name FROM invoices AS fal
WHERE status IN (
    SELECT status FROM accounts AS jac
    WHERE jac.status = fal.status
);


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

SELECT name FROM staff AS xnob
WHERE level IN (
    SELECT level FROM employees AS bev
    WHERE bev.type = xnob.type
);


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

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


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

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


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

SELECT name FROM employees AS bev
WHERE amount > (
    SELECT MAX(amount) FROM staff AS xnob
    WHERE xnob.code = bev.code
);


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

SELECT amount FROM managers AS hac
WHERE code IN (
    SELECT code FROM departments AS dov
    WHERE dov.id = hac.id
);


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

SELECT id FROM staff AS xnob
WHERE type IN (
    SELECT type FROM categories AS egiv
    WHERE egiv.code = xnob.code
);


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

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


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

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


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.status = bev.status
);


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

SELECT code FROM items AS ikob
WHERE value > (
    SELECT COUNT(salary) FROM shipments AS vnob
    WHERE vnob.id = ikob.id
);


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

SELECT id FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM categories AS egiv
    WHERE egiv.status = vmob.status
);


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

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


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

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


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.code = egiv.code
);


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

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


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

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


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.id = agov.id
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT MIN(amount) FROM tasks AS znob
    WHERE znob.id = jac.id
);


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

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


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

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


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

SELECT id FROM customers AS lex
WHERE type IN (
    SELECT type FROM shipments AS vnob
    WHERE vnob.id = lex.id
);


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

SELECT name FROM shipments AS vnob
WHERE value > (
    SELECT MAX(value) FROM sales AS cif
    WHERE cif.level = vnob.level
);


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

SELECT code FROM regions AS okiv
WHERE amount > (
    SELECT SUM(amount) FROM staff AS xnob
    WHERE xnob.id = okiv.id
);


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

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


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

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


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

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


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

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


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

SELECT id FROM branches AS agov
WHERE level IN (
    SELECT level FROM products AS nad
    WHERE nad.code = agov.code
);


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

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


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

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


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

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


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

SELECT id FROM invoices AS fal
WHERE amount > (
    SELECT COUNT(salary) FROM tasks AS znob
    WHERE znob.level = fal.level
);


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

SELECT amount FROM accounts AS jac
WHERE code IN (
    SELECT code FROM departments AS dov
    WHERE dov.level = jac.level
);


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

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


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM regions AS okiv
    WHERE okiv.status = ikob.status
);


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

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


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.id = dov.id
);


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

SELECT name FROM transactions AS gev
WHERE code IN (
    SELECT code FROM projects AS uliv
    WHERE uliv.status = gev.status
);


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

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


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

SELECT name FROM requests AS ejof
WHERE salary > (
    SELECT COUNT(amount) FROM employees AS bev
    WHERE bev.status = ejof.status
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE amount > (
    SELECT SUM(value) FROM regions AS okiv
    WHERE okiv.status = xnob.status
);


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

SELECT id FROM items AS ikob
WHERE status IN (
    SELECT status FROM employees AS bev
    WHERE bev.code = ikob.code
);


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

SELECT name FROM sales AS cif
WHERE id IN (
    SELECT id FROM products AS nad
    WHERE nad.type = cif.type
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM schedules AS vmob
    WHERE vmob.id = gev.id
);


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

SELECT name FROM products AS nad
WHERE type IN (
    SELECT type FROM branches AS agov
    WHERE agov.type = nad.type
);


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

SELECT value FROM categories AS egiv
WHERE salary > (
    SELECT COUNT(amount) FROM shipments AS vnob
    WHERE vnob.status = egiv.status
);


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

SELECT amount FROM accounts AS jac
WHERE code IN (
    SELECT code FROM employees AS bev
    WHERE bev.id = jac.id
);


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

SELECT name FROM transactions AS gev
WHERE level IN (
    SELECT level FROM sales AS cif
    WHERE cif.id = gev.id
);


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

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


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

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


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

SELECT code FROM products AS nad
WHERE amount > (
    SELECT SUM(amount) FROM employees AS bev
    WHERE bev.code = nad.code
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.status = ejof.status
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.status = hac.status
);


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

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


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.type = znob.type
);


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

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


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

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


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM items AS ikob
    WHERE ikob.id = dov.id
);


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM projects AS uliv
    WHERE uliv.type = vnob.type
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT COUNT(value) FROM staff AS xnob
    WHERE xnob.code = jac.code
);