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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM regions AS fal
    WHERE fal.level = jac.level
);


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

SELECT value FROM invoices AS fal
WHERE type IN (
    SELECT type FROM sales AS gev
    WHERE gev.type = fal.type
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT AVG(amount) FROM employees AS gev
    WHERE gev.level = hac.level
);


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

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


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

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


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.type = kab.type
);


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

SELECT code FROM employees AS bev
WHERE level IN (
    SELECT level FROM orders AS kab
    WHERE kab.level = bev.level
);


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

SELECT amount FROM staff AS xnob
WHERE salary > (
    SELECT MIN(amount) FROM orders AS vnob
    WHERE vnob.code = xnob.code
);


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

SELECT salary FROM branches AS agov
WHERE salary > (
    SELECT COUNT(value) FROM transactions AS vmob
    WHERE vmob.id = agov.id
);


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM orders AS xnob
    WHERE xnob.status = lex.status
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM invoices AS dov
    WHERE dov.level = lex.level
);


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

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


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

SELECT value FROM sales AS cif
WHERE code IN (
    SELECT code FROM branches AS lex
    WHERE lex.code = cif.code
);


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

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


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

SELECT salary FROM transactions AS gev
WHERE type IN (
    SELECT type FROM departments AS xnob
    WHERE xnob.type = gev.type
);


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

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


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

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


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

SELECT name FROM customers AS lex
WHERE value > (
    SELECT SUM(salary) FROM items AS kab
    WHERE kab.id = lex.id
);


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

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


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

SELECT code FROM tasks AS znob
WHERE id IN (
    SELECT id FROM departments AS ikob
    WHERE ikob.code = znob.code
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM departments AS ikob
    WHERE ikob.status = vmob.status
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM employees AS dov
    WHERE dov.code = vmob.code
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM shipments AS lex
    WHERE lex.status = xnob.status
);


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

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


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS nad
    WHERE nad.status = hac.status
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM branches AS hac
    WHERE hac.id = gev.id
);


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

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


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

SELECT value FROM orders AS kab
WHERE salary > (
    SELECT MAX(amount) FROM shipments AS jac
    WHERE jac.code = kab.code
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM branches AS uliv
    WHERE uliv.level = hac.level
);


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

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


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM invoices AS znob
    WHERE znob.type = ejof.type
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM projects AS xnob
    WHERE xnob.id = hac.id
);


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM invoices AS dov
    WHERE dov.level = ejof.level
);


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM shipments AS nad
    WHERE nad.level = vmob.level
);


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

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


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

SELECT value FROM tasks AS znob
WHERE amount > (
    SELECT AVG(salary) FROM sales AS bev
    WHERE bev.type = znob.type
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM products AS jac
    WHERE jac.type = uliv.type
);


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT MIN(salary) FROM products AS vmob
    WHERE vmob.type = dov.type
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM accounts AS vmob
    WHERE vmob.code = cif.code
);


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

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


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

SELECT code FROM items AS ikob
WHERE type IN (
    SELECT type FROM staff AS kab
    WHERE kab.id = ikob.id
);


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

SELECT id FROM products AS nad
WHERE value > (
    SELECT AVG(amount) FROM projects AS hac
    WHERE hac.level = nad.level
);


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

SELECT amount FROM items AS ikob
WHERE amount > (
    SELECT COUNT(value) FROM regions AS bev
    WHERE bev.status = ikob.status
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM departments AS kab
    WHERE kab.code = cif.code
);


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

SELECT code FROM shipments AS vnob
WHERE salary > (
    SELECT MIN(salary) FROM staff AS dov
    WHERE dov.id = vnob.id
);


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

SELECT amount FROM shipments AS vnob
WHERE salary > (
    SELECT SUM(salary) FROM orders AS lex
    WHERE lex.level = vnob.level
);


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

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


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS xnob
    WHERE xnob.level = vnob.level
);


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

SELECT code FROM branches AS agov
WHERE amount > (
    SELECT MAX(salary) FROM sales AS xnob
    WHERE xnob.status = agov.status
);


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

SELECT id FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM accounts AS lex
    WHERE lex.status = nad.status
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS lex
    WHERE lex.type = nad.type
);


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

SELECT id FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(amount) FROM schedules AS fal
    WHERE fal.status = znob.status
);


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

SELECT code FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM items AS xnob
    WHERE xnob.id = vnob.id
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM managers AS dov
    WHERE dov.id = okiv.id
);


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

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


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.id = vnob.id
);


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

SELECT id FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.code = kab.code
);


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

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


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

SELECT id FROM projects AS uliv
WHERE status IN (
    SELECT status FROM transactions AS kab
    WHERE kab.type = uliv.type
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM categories AS egiv
    WHERE egiv.level = cif.level
);


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

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


Prompt:
Schema:
  requests (alias: ejof)(type, level, status, code)
  regions(type, amount, level, status)
Task: Retrieve name from requests with salary above the AVG(amount) of regions rows sharing the same code.
SQL:

SELECT name FROM requests AS ejof
WHERE salary > (
    SELECT AVG(amount) FROM regions AS nad
    WHERE nad.code = ejof.code
);


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM departments AS bev
    WHERE bev.id = jac.id
);


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

SELECT id FROM projects AS uliv
WHERE code IN (
    SELECT code FROM transactions AS ejof
    WHERE ejof.id = uliv.id
);


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

SELECT name FROM projects AS uliv
WHERE code IN (
    SELECT code FROM invoices AS hac
    WHERE hac.level = uliv.level
);


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

SELECT amount FROM projects AS uliv
WHERE level IN (
    SELECT level FROM branches AS dov
    WHERE dov.type = uliv.type
);


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

SELECT code FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM products AS fal
    WHERE fal.type = okiv.type
);


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

SELECT amount FROM regions AS okiv
WHERE code IN (
    SELECT code FROM schedules AS jac
    WHERE jac.level = okiv.level
);


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.id = uliv.id
);


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

SELECT code FROM departments AS dov
WHERE salary > (
    SELECT AVG(amount) FROM items AS cif
    WHERE cif.status = dov.status
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM accounts AS fal
    WHERE fal.code = xnob.code
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT COUNT(value) FROM requests AS fal
    WHERE fal.status = okiv.status
);


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM tasks AS vmob
    WHERE vmob.level = cif.level
);


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

SELECT salary FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM orders AS znob
    WHERE znob.status = vmob.status
);


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

SELECT amount FROM tasks AS znob
WHERE value > (
    SELECT MIN(salary) FROM managers AS vnob
    WHERE vnob.type = znob.type
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM transactions AS fal
    WHERE fal.code = vnob.code
);


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

SELECT id FROM items AS ikob
WHERE amount > (
    SELECT MAX(amount) FROM categories AS vmob
    WHERE vmob.level = ikob.level
);


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

SELECT amount FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM items AS jac
    WHERE jac.code = vmob.code
);


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

SELECT salary FROM branches AS agov
WHERE status IN (
    SELECT status FROM items AS hac
    WHERE hac.level = agov.level
);


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS gev
    WHERE gev.level = egiv.level
);


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

SELECT name FROM transactions AS gev
WHERE level IN (
    SELECT level FROM customers AS kab
    WHERE kab.status = gev.status
);


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM requests AS vmob
    WHERE vmob.status = ikob.status
);


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

SELECT name FROM products AS nad
WHERE id IN (
    SELECT id FROM employees AS kab
    WHERE kab.code = nad.code
);


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

SELECT id FROM branches AS agov
WHERE value > (
    SELECT AVG(value) FROM categories AS uliv
    WHERE uliv.level = agov.level
);


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

SELECT code FROM requests AS ejof
WHERE id IN (
    SELECT id FROM shipments AS uliv
    WHERE uliv.type = ejof.type
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.code = nad.code
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM projects AS egiv
    WHERE egiv.code = ejof.code
);


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

SELECT id FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM requests AS hac
    WHERE hac.level = vnob.level
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM accounts AS agov
    WHERE agov.code = bev.code
);


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

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


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM invoices AS kab
    WHERE kab.level = lex.level
);


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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM employees AS znob
    WHERE znob.status = jac.status
);


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

SELECT code FROM tasks AS znob
WHERE code IN (
    SELECT code FROM managers AS gev
    WHERE gev.type = znob.type
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.type = vnob.type
);


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

SELECT value FROM categories AS egiv
WHERE level IN (
    SELECT level FROM orders AS ejof
    WHERE ejof.type = egiv.type
);


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

SELECT code FROM items AS ikob
WHERE id IN (
    SELECT id FROM categories AS fal
    WHERE fal.status = ikob.status
);


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

SELECT salary FROM accounts AS jac
WHERE status IN (
    SELECT status FROM schedules AS znob
    WHERE znob.id = jac.id
);


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

SELECT name FROM branches AS agov
WHERE salary > (
    SELECT MIN(salary) FROM managers AS ikob
    WHERE ikob.level = agov.level
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM staff AS cif
    WHERE cif.level = fal.level
);


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

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


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

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


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

SELECT code FROM employees AS bev
WHERE salary > (
    SELECT MAX(amount) FROM orders AS vmob
    WHERE vmob.status = bev.status
);


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

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


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

SELECT salary FROM sales AS cif
WHERE salary > (
    SELECT MAX(salary) FROM products AS hac
    WHERE hac.type = cif.type
);


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

SELECT id FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM transactions AS cif
    WHERE cif.id = jac.id
);


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

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


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

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


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM accounts AS nad
    WHERE nad.code = egiv.code
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS okiv
    WHERE okiv.status = dov.status
);


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

SELECT amount FROM employees AS bev
WHERE status IN (
    SELECT status FROM projects AS egiv
    WHERE egiv.type = bev.type
);


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

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


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT AVG(value) FROM employees AS ikob
    WHERE ikob.id = agov.id
);


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

SELECT value FROM orders AS kab
WHERE salary > (
    SELECT MAX(salary) FROM employees AS xnob
    WHERE xnob.id = kab.id
);


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

SELECT salary FROM regions AS okiv
WHERE salary > (
    SELECT MAX(amount) FROM transactions AS lex
    WHERE lex.status = okiv.status
);


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

SELECT salary FROM staff AS xnob
WHERE id IN (
    SELECT id FROM sales AS agov
    WHERE agov.status = xnob.status
);


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

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


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

SELECT name FROM projects AS uliv
WHERE value > (
    SELECT MIN(value) FROM departments AS cif
    WHERE cif.code = uliv.code
);


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

SELECT id FROM requests AS ejof
WHERE code IN (
    SELECT code FROM invoices AS uliv
    WHERE uliv.status = ejof.status
);


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

SELECT amount FROM categories AS egiv
WHERE code IN (
    SELECT code FROM branches AS agov
    WHERE agov.type = egiv.type
);


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

SELECT id FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM projects AS cif
    WHERE cif.status = vmob.status
);


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

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


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

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


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM categories AS hac
    WHERE hac.status = xnob.status
);


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

SELECT code FROM orders AS kab
WHERE value > (
    SELECT SUM(value) FROM managers AS vnob
    WHERE vnob.code = kab.code
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT AVG(salary) FROM transactions AS agov
    WHERE agov.type = hac.type
);


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

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


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

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


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

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


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

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


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM requests AS znob
    WHERE znob.status = hac.status
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM departments AS dov
    WHERE dov.level = agov.level
);


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

SELECT id FROM sales AS cif
WHERE code IN (
    SELECT code FROM projects AS xnob
    WHERE xnob.level = cif.level
);


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

SELECT id FROM items AS ikob
WHERE status IN (
    SELECT status FROM orders AS vnob
    WHERE vnob.level = ikob.level
);


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

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


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

SELECT code FROM staff AS xnob
WHERE type IN (
    SELECT type FROM customers AS hac
    WHERE hac.type = xnob.type
);


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

SELECT id FROM sales AS cif
WHERE value > (
    SELECT AVG(value) FROM regions AS bev
    WHERE bev.code = cif.code
);


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

SELECT value FROM customers AS lex
WHERE status IN (
    SELECT status FROM accounts AS uliv
    WHERE uliv.level = lex.level
);


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

SELECT name FROM projects AS uliv
WHERE type IN (
    SELECT type FROM accounts AS xnob
    WHERE xnob.type = uliv.type
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM tasks AS vnob
    WHERE vnob.status = cif.status
);


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

SELECT name FROM staff AS xnob
WHERE code IN (
    SELECT code FROM managers AS okiv
    WHERE okiv.level = xnob.level
);


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

SELECT id FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM sales AS nad
    WHERE nad.level = okiv.level
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM departments AS ikob
    WHERE ikob.status = gev.status
);


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

SELECT amount FROM tasks AS znob
WHERE type IN (
    SELECT type FROM employees AS gev
    WHERE gev.type = znob.type
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM transactions AS vnob
    WHERE vnob.status = okiv.status
);


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

SELECT name FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM sales AS kab
    WHERE kab.status = vmob.status
);


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

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


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

SELECT id FROM accounts AS jac
WHERE salary > (
    SELECT AVG(salary) FROM projects AS okiv
    WHERE okiv.status = jac.status
);


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

SELECT id FROM departments AS dov
WHERE value > (
    SELECT MAX(value) FROM staff AS bev
    WHERE bev.id = dov.id
);


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

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


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

SELECT code FROM shipments AS vnob
WHERE salary > (
    SELECT SUM(amount) FROM items AS znob
    WHERE znob.type = vnob.type
);


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

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT SUM(value) FROM shipments AS xnob
    WHERE xnob.level = ikob.level
);


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

SELECT value FROM customers AS lex
WHERE status IN (
    SELECT status FROM tasks AS xnob
    WHERE xnob.status = lex.status
);


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

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


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

SELECT id FROM staff AS xnob
WHERE id IN (
    SELECT id FROM branches AS bev
    WHERE bev.level = xnob.level
);


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

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


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM requests AS gev
    WHERE gev.code = hac.code
);


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

SELECT amount FROM managers AS hac
WHERE salary > (
    SELECT MAX(value) FROM regions AS jac
    WHERE jac.code = hac.code
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM employees AS ejof
    WHERE ejof.type = cif.type
);


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

SELECT id FROM accounts AS jac
WHERE status IN (
    SELECT status FROM tasks AS xnob
    WHERE xnob.code = jac.code
);


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

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


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM customers AS egiv
    WHERE egiv.type = cif.type
);


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

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT COUNT(salary) FROM regions AS gev
    WHERE gev.code = egiv.code
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM categories AS znob
    WHERE znob.type = kab.type
);


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

SELECT name FROM items AS ikob
WHERE amount > (
    SELECT MIN(amount) FROM departments AS bev
    WHERE bev.level = ikob.level
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM invoices AS xnob
    WHERE xnob.code = bev.code
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS cif
    WHERE cif.code = egiv.code
);


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

SELECT name FROM employees AS bev
WHERE status IN (
    SELECT status FROM departments AS gev
    WHERE gev.id = bev.id
);


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

SELECT salary FROM branches AS agov
WHERE id IN (
    SELECT id FROM projects AS gev
    WHERE gev.id = agov.id
);


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

SELECT name FROM requests AS ejof
WHERE level IN (
    SELECT level FROM departments AS hac
    WHERE hac.level = ejof.level
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM customers AS nad
    WHERE nad.level = hac.level
);


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

SELECT value FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM customers AS znob
    WHERE znob.type = fal.type
);


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

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


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

SELECT id FROM customers AS lex
WHERE id IN (
    SELECT id FROM schedules AS dov
    WHERE dov.code = lex.code
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS bev
    WHERE bev.type = nad.type
);


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

SELECT value FROM invoices AS fal
WHERE amount > (
    SELECT MAX(value) FROM sales AS xnob
    WHERE xnob.code = fal.code
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM customers AS xnob
    WHERE xnob.type = ikob.type
);


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

SELECT id FROM categories AS egiv
WHERE code IN (
    SELECT code FROM items AS ikob
    WHERE ikob.level = egiv.level
);


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

SELECT code FROM shipments AS vnob
WHERE salary > (
    SELECT MAX(salary) FROM projects AS gev
    WHERE gev.status = vnob.status
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS agov
    WHERE agov.level = fal.level
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM employees AS okiv
    WHERE okiv.level = xnob.level
);


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

SELECT id FROM customers AS lex
WHERE id IN (
    SELECT id FROM departments AS hac
    WHERE hac.status = lex.status
);


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

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


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

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


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

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


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

SELECT value FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM employees AS gev
    WHERE gev.code = vnob.code
);


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

SELECT id FROM categories AS egiv
WHERE level IN (
    SELECT level FROM staff AS nad
    WHERE nad.status = egiv.status
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM items AS ejof
    WHERE ejof.code = hac.code
);


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

SELECT code FROM departments AS dov
WHERE value > (
    SELECT MIN(salary) FROM managers AS gev
    WHERE gev.code = dov.code
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM invoices AS ejof
    WHERE ejof.level = egiv.level
);


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

SELECT code FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM branches AS ejof
    WHERE ejof.level = cif.level
);


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

SELECT id FROM invoices AS fal
WHERE level IN (
    SELECT level FROM departments AS ikob
    WHERE ikob.status = fal.status
);


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM accounts AS bev
    WHERE bev.status = egiv.status
);


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

SELECT value FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM branches AS nad
    WHERE nad.status = vnob.status
);


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

SELECT id FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM shipments AS bev
    WHERE bev.status = ikob.status
);


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

SELECT value FROM accounts AS jac
WHERE value > (
    SELECT AVG(salary) FROM tasks AS okiv
    WHERE okiv.level = jac.level
);


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

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


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM sales AS kab
    WHERE kab.status = vnob.status
);


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

SELECT value FROM departments AS dov
WHERE value > (
    SELECT MAX(value) FROM projects AS gev
    WHERE gev.type = dov.type
);


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

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


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

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


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

SELECT id FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(value) FROM sales AS nad
    WHERE nad.code = vnob.code
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM branches AS fal
    WHERE fal.code = xnob.code
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM tasks AS fal
    WHERE fal.level = kab.level
);


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM branches AS kab
    WHERE kab.code = jac.code
);


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

SELECT name FROM projects AS uliv
WHERE level IN (
    SELECT level FROM regions AS kab
    WHERE kab.status = uliv.status
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM staff AS ikob
    WHERE ikob.code = bev.code
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM sales AS gev
    WHERE gev.level = dov.level
);


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM sales AS okiv
    WHERE okiv.status = jac.status
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM orders AS kab
    WHERE kab.code = hac.code
);


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

SELECT name FROM orders AS kab
WHERE value > (
    SELECT AVG(value) FROM shipments AS dov
    WHERE dov.type = kab.type
);


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

SELECT code FROM staff AS xnob
WHERE type IN (
    SELECT type FROM schedules AS uliv
    WHERE uliv.type = xnob.type
);


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

SELECT name FROM regions AS okiv
WHERE salary > (
    SELECT MIN(amount) FROM staff AS znob
    WHERE znob.type = okiv.type
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM items AS lex
    WHERE lex.type = nad.type
);


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

SELECT amount FROM transactions AS gev
WHERE status IN (
    SELECT status FROM shipments AS lex
    WHERE lex.id = gev.id
);


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

SELECT name FROM departments AS dov
WHERE level IN (
    SELECT level FROM managers AS znob
    WHERE znob.code = dov.code
);


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

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT MIN(salary) FROM products AS nad
    WHERE nad.level = egiv.level
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.status = hac.status
);


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

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


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

SELECT value FROM customers AS lex
WHERE salary > (
    SELECT SUM(salary) FROM requests AS bev
    WHERE bev.code = lex.code
);


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

SELECT code FROM employees AS bev
WHERE value > (
    SELECT SUM(salary) FROM tasks AS agov
    WHERE agov.id = bev.id
);


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

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


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS uliv
    WHERE uliv.id = hac.id
);


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

SELECT salary FROM managers AS hac
WHERE id IN (
    SELECT id FROM orders AS nad
    WHERE nad.code = hac.code
);


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

SELECT salary FROM sales AS cif
WHERE value > (
    SELECT MAX(value) FROM branches AS ejof
    WHERE ejof.code = cif.code
);


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

SELECT salary FROM items AS ikob
WHERE type IN (
    SELECT type FROM orders AS hac
    WHERE hac.status = ikob.status
);


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

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


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

SELECT code FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM schedules AS znob
    WHERE znob.type = vnob.type
);


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM items AS cif
    WHERE cif.status = vmob.status
);


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

SELECT value FROM orders AS kab
WHERE code IN (
    SELECT code FROM regions AS uliv
    WHERE uliv.level = kab.level
);


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

SELECT code FROM staff AS xnob
WHERE code IN (
    SELECT code FROM employees AS ejof
    WHERE ejof.type = xnob.type
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM employees AS lex
    WHERE lex.id = vnob.id
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT COUNT(salary) FROM transactions AS fal
    WHERE fal.code = jac.code
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM branches AS kab
    WHERE kab.code = hac.code
);


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

SELECT code FROM orders AS kab
WHERE salary > (
    SELECT COUNT(salary) FROM shipments AS agov
    WHERE agov.status = kab.status
);


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

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


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM accounts AS uliv
    WHERE uliv.level = vmob.level
);


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

SELECT amount FROM tasks AS znob
WHERE type IN (
    SELECT type FROM invoices AS dov
    WHERE dov.status = znob.status
);


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

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


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

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


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

SELECT amount FROM items AS ikob
WHERE type IN (
    SELECT type FROM tasks AS agov
    WHERE agov.code = ikob.code
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.status = lex.status
);


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

SELECT amount FROM accounts AS jac
WHERE value > (
    SELECT MIN(amount) FROM customers AS vmob
    WHERE vmob.type = jac.type
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM categories AS agov
    WHERE agov.id = gev.id
);


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

SELECT salary FROM requests AS ejof
WHERE value > (
    SELECT COUNT(salary) FROM departments AS lex
    WHERE lex.status = ejof.status
);


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

SELECT value FROM staff AS xnob
WHERE level IN (
    SELECT level FROM shipments AS uliv
    WHERE uliv.type = xnob.type
);


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

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


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

SELECT name FROM departments AS dov
WHERE type IN (
    SELECT type FROM sales AS lex
    WHERE lex.status = dov.status
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS vnob
    WHERE vnob.type = gev.type
);


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.type = bev.type
);


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

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


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

SELECT name FROM categories AS egiv
WHERE code IN (
    SELECT code FROM tasks AS jac
    WHERE jac.type = egiv.type
);


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

SELECT name FROM customers AS lex
WHERE status IN (
    SELECT status FROM departments AS dov
    WHERE dov.id = lex.id
);


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

SELECT salary FROM sales AS cif
WHERE code IN (
    SELECT code FROM shipments AS jac
    WHERE jac.type = cif.type
);


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

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


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

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


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

SELECT id FROM employees AS bev
WHERE value > (
    SELECT COUNT(amount) FROM invoices AS ejof
    WHERE ejof.id = bev.id
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM products AS jac
    WHERE jac.status = dov.status
);


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

SELECT code FROM managers AS hac
WHERE type IN (
    SELECT type FROM schedules AS gev
    WHERE gev.status = hac.status
);


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

SELECT name FROM staff AS xnob
WHERE code IN (
    SELECT code FROM tasks AS dov
    WHERE dov.id = xnob.id
);


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

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


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM invoices AS ikob
    WHERE ikob.status = uliv.status
);


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

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


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

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


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

SELECT code FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM requests AS hac
    WHERE hac.type = vmob.type
);


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT MIN(value) FROM branches AS hac
    WHERE hac.id = fal.id
);


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

SELECT id FROM tasks AS znob
WHERE level IN (
    SELECT level FROM regions AS cif
    WHERE cif.status = znob.status
);


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 jac
    WHERE jac.id = egiv.id
);


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

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


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

SELECT name FROM requests AS ejof
WHERE status IN (
    SELECT status FROM managers AS egiv
    WHERE egiv.status = ejof.status
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM products AS fal
    WHERE fal.type = ejof.type
);


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

SELECT amount FROM customers AS lex
WHERE amount > (
    SELECT SUM(salary) FROM managers AS xnob
    WHERE xnob.code = lex.code
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM projects AS bev
    WHERE bev.type = ikob.type
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM items AS kab
    WHERE kab.type = okiv.type
);


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

SELECT id FROM products AS nad
WHERE id IN (
    SELECT id FROM customers AS okiv
    WHERE okiv.type = nad.type
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS kab
    WHERE kab.code = hac.code
);


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

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


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM items AS znob
    WHERE znob.level = uliv.level
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM employees AS ejof
    WHERE ejof.level = kab.level
);


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM regions AS bev
    WHERE bev.status = znob.status
);


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

SELECT id FROM products AS nad
WHERE value > (
    SELECT COUNT(value) FROM departments AS znob
    WHERE znob.status = nad.status
);


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

SELECT name FROM projects AS uliv
WHERE type IN (
    SELECT type FROM categories AS egiv
    WHERE egiv.level = uliv.level
);


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

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


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

SELECT code FROM customers AS lex
WHERE id IN (
    SELECT id FROM invoices AS vnob
    WHERE vnob.level = lex.level
);


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

SELECT id FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM shipments AS gev
    WHERE gev.status = vmob.status
);


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

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


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM invoices AS znob
    WHERE znob.status = uliv.status
);


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

SELECT amount FROM categories AS egiv
WHERE level IN (
    SELECT level FROM departments AS uliv
    WHERE uliv.status = egiv.status
);


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM regions AS lex
    WHERE lex.code = ejof.code
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM sales AS kab
    WHERE kab.level = xnob.level
);


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

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


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

SELECT name FROM sales AS cif
WHERE status IN (
    SELECT status FROM projects AS agov
    WHERE agov.id = cif.id
);


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

SELECT id FROM orders AS kab
WHERE level IN (
    SELECT level FROM managers AS vnob
    WHERE vnob.id = kab.id
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM customers AS agov
    WHERE agov.level = ikob.level
);


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

SELECT name FROM products AS nad
WHERE salary > (
    SELECT SUM(salary) FROM items AS agov
    WHERE agov.level = nad.level
);


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM shipments AS hac
    WHERE hac.level = ikob.level
);


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

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


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

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


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

SELECT value FROM managers AS hac
WHERE code IN (
    SELECT code FROM orders AS fal
    WHERE fal.code = hac.code
);