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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM products AS ikob
    WHERE ikob.level = lex.level
);


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

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


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

SELECT value FROM staff AS xnob
WHERE value > (
    SELECT AVG(amount) FROM categories AS hac
    WHERE hac.type = xnob.type
);


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

SELECT salary FROM projects AS uliv
WHERE value > (
    SELECT COUNT(amount) FROM transactions AS nad
    WHERE nad.type = uliv.type
);


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

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


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

SELECT name FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM shipments AS cif
    WHERE cif.status = fal.status
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM customers AS hac
    WHERE hac.level = dov.level
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS egiv
    WHERE egiv.type = hac.type
);


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

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


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

SELECT value FROM branches AS agov
WHERE amount > (
    SELECT AVG(value) FROM orders AS dov
    WHERE dov.type = agov.type
);


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

SELECT value FROM products AS nad
WHERE code IN (
    SELECT code FROM staff AS znob
    WHERE znob.status = nad.status
);


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

SELECT salary FROM staff AS xnob
WHERE status IN (
    SELECT status FROM projects AS okiv
    WHERE okiv.type = xnob.type
);


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

SELECT salary FROM employees AS bev
WHERE amount > (
    SELECT MIN(amount) FROM projects AS hac
    WHERE hac.code = bev.code
);


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT MAX(salary) FROM customers AS lex
    WHERE lex.status = cif.status
);


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

SELECT code FROM staff AS xnob
WHERE salary > (
    SELECT SUM(value) FROM requests AS okiv
    WHERE okiv.id = xnob.id
);


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

SELECT amount FROM invoices AS fal
WHERE id IN (
    SELECT id FROM products AS vnob
    WHERE vnob.type = fal.type
);


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM managers AS agov
    WHERE agov.id = uliv.id
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM departments AS hac
    WHERE hac.id = kab.id
);


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

SELECT salary FROM branches AS agov
WHERE id IN (
    SELECT id FROM categories AS jac
    WHERE jac.code = agov.code
);


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

SELECT salary FROM tasks AS znob
WHERE salary > (
    SELECT MIN(amount) FROM managers AS agov
    WHERE agov.id = znob.id
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM projects AS kab
    WHERE kab.id = xnob.id
);


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

SELECT value FROM branches AS agov
WHERE salary > (
    SELECT MIN(amount) FROM tasks AS egiv
    WHERE egiv.status = agov.status
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM sales AS ejof
    WHERE ejof.type = vnob.type
);


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

SELECT amount FROM categories AS egiv
WHERE salary > (
    SELECT MAX(amount) FROM branches AS nad
    WHERE nad.id = egiv.id
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT MAX(amount) FROM schedules AS ejof
    WHERE ejof.type = hac.type
);


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

SELECT salary FROM regions AS okiv
WHERE amount > (
    SELECT AVG(value) FROM customers AS znob
    WHERE znob.id = okiv.id
);


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

SELECT value FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM invoices AS dov
    WHERE dov.type = vnob.type
);


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM shipments AS okiv
    WHERE okiv.type = jac.type
);


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

SELECT name FROM managers AS hac
WHERE salary > (
    SELECT SUM(amount) FROM customers AS okiv
    WHERE okiv.type = hac.type
);


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

SELECT value FROM projects AS uliv
WHERE value > (
    SELECT SUM(value) FROM branches AS kab
    WHERE kab.id = uliv.id
);


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

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


Prompt:
Schema:
  projects (alias: uliv)(salary, date, value, id)
  branches(value, amount, salary, id)
Task: Retrieve value from projects with salary above the SUM(salary) of branches rows sharing the same id.
SQL:

SELECT value FROM projects AS uliv
WHERE salary > (
    SELECT SUM(salary) FROM branches AS agov
    WHERE agov.id = uliv.id
);


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM tasks AS dov
    WHERE dov.level = ikob.level
);


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

SELECT value FROM transactions AS gev
WHERE value > (
    SELECT MIN(value) FROM invoices AS okiv
    WHERE okiv.level = gev.level
);


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

SELECT name FROM requests AS ejof
WHERE amount > (
    SELECT MIN(amount) FROM products AS uliv
    WHERE uliv.type = ejof.type
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM orders AS cif
    WHERE cif.type = xnob.type
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.level = ejof.level
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM staff AS bev
    WHERE bev.level = agov.level
);


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

SELECT code FROM staff AS xnob
WHERE salary > (
    SELECT COUNT(value) FROM shipments AS egiv
    WHERE egiv.code = xnob.code
);


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

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


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

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


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

SELECT salary FROM regions AS okiv
WHERE status IN (
    SELECT status FROM orders AS fal
    WHERE fal.level = okiv.level
);


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

SELECT id FROM transactions AS gev
WHERE amount > (
    SELECT COUNT(amount) FROM branches AS ikob
    WHERE ikob.status = gev.status
);


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

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


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM departments AS nad
    WHERE nad.type = vmob.type
);


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

SELECT salary FROM categories AS egiv
WHERE value > (
    SELECT MIN(amount) FROM transactions AS uliv
    WHERE uliv.status = egiv.status
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS fal
    WHERE fal.type = hac.type
);


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

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


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

SELECT amount FROM categories AS egiv
WHERE type IN (
    SELECT type FROM shipments AS jac
    WHERE jac.status = egiv.status
);


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

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


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

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


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

SELECT value FROM accounts AS jac
WHERE code IN (
    SELECT code FROM departments AS ikob
    WHERE ikob.code = jac.code
);


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

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


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

SELECT code FROM tasks AS znob
WHERE amount > (
    SELECT AVG(value) FROM invoices AS xnob
    WHERE xnob.id = znob.id
);


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

SELECT salary FROM regions AS okiv
WHERE amount > (
    SELECT SUM(amount) FROM schedules AS ikob
    WHERE ikob.type = okiv.type
);


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

SELECT value FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM projects AS cif
    WHERE cif.id = vnob.id
);


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

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


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

SELECT name FROM transactions AS gev
WHERE type IN (
    SELECT type FROM branches AS lex
    WHERE lex.id = gev.id
);


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

SELECT amount FROM tasks AS znob
WHERE amount > (
    SELECT COUNT(amount) FROM categories AS lex
    WHERE lex.type = znob.type
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM orders AS egiv
    WHERE egiv.type = vmob.type
);


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

SELECT amount FROM regions AS okiv
WHERE amount > (
    SELECT COUNT(value) FROM orders AS agov
    WHERE agov.type = okiv.type
);


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

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


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM products AS bev
    WHERE bev.level = agov.level
);


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

SELECT id FROM invoices AS fal
WHERE code IN (
    SELECT code FROM items AS hac
    WHERE hac.status = fal.status
);


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

SELECT name FROM employees AS bev
WHERE level IN (
    SELECT level FROM transactions AS jac
    WHERE jac.status = bev.status
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM requests AS ikob
    WHERE ikob.type = cif.type
);


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

SELECT salary FROM requests AS ejof
WHERE code IN (
    SELECT code FROM regions AS dov
    WHERE dov.status = ejof.status
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM items AS hac
    WHERE hac.id = agov.id
);


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

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


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

SELECT value FROM products AS nad
WHERE salary > (
    SELECT COUNT(amount) FROM staff AS okiv
    WHERE okiv.status = nad.status
);


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

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT COUNT(value) FROM managers AS cif
    WHERE cif.level = ejof.level
);


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

SELECT amount FROM transactions AS gev
WHERE value > (
    SELECT MAX(salary) FROM departments AS lex
    WHERE lex.status = gev.status
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM items AS agov
    WHERE agov.status = vmob.status
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM customers AS okiv
    WHERE okiv.type = dov.type
);


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

SELECT amount FROM employees AS bev
WHERE type IN (
    SELECT type FROM regions AS vnob
    WHERE vnob.status = bev.status
);


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

SELECT amount FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM products AS znob
    WHERE znob.level = vnob.level
);


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

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


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS znob
    WHERE znob.type = fal.type
);


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

SELECT salary FROM orders AS kab
WHERE level IN (
    SELECT level FROM requests AS bev
    WHERE bev.status = kab.status
);


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

SELECT id FROM categories AS egiv
WHERE status IN (
    SELECT status FROM employees AS fal
    WHERE fal.level = egiv.level
);


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

SELECT id FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.code = ikob.code
);


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

SELECT code FROM projects AS uliv
WHERE salary > (
    SELECT AVG(amount) FROM sales AS fal
    WHERE fal.type = uliv.type
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM transactions AS egiv
    WHERE egiv.level = xnob.level
);


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

SELECT value FROM projects AS uliv
WHERE amount > (
    SELECT COUNT(value) FROM tasks AS cif
    WHERE cif.code = uliv.code
);


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT MIN(salary) FROM transactions AS okiv
    WHERE okiv.status = bev.status
);


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

SELECT id FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM invoices AS vnob
    WHERE vnob.level = bev.level
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS agov
    WHERE agov.code = okiv.code
);


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

SELECT code FROM categories AS egiv
WHERE value > (
    SELECT AVG(value) FROM requests AS znob
    WHERE znob.type = egiv.type
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM customers AS bev
    WHERE bev.code = ejof.code
);


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

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


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

SELECT id FROM projects AS uliv
WHERE type IN (
    SELECT type FROM items AS xnob
    WHERE xnob.level = uliv.level
);


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

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


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

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


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM sales AS jac
    WHERE jac.type = gev.type
);


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

SELECT code FROM shipments AS vnob
WHERE value > (
    SELECT AVG(amount) FROM branches AS bev
    WHERE bev.status = vnob.status
);


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

SELECT id FROM accounts AS jac
WHERE salary > (
    SELECT AVG(value) FROM projects AS nad
    WHERE nad.level = jac.level
);


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

SELECT id FROM managers AS hac
WHERE value > (
    SELECT COUNT(value) FROM projects AS egiv
    WHERE egiv.id = hac.id
);


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

SELECT salary FROM regions AS okiv
WHERE status IN (
    SELECT status FROM requests AS jac
    WHERE jac.code = okiv.code
);


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

SELECT code FROM managers AS hac
WHERE value > (
    SELECT COUNT(value) FROM transactions AS nad
    WHERE nad.status = hac.status
);


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

SELECT salary FROM categories AS egiv
WHERE amount > (
    SELECT AVG(value) FROM requests AS gev
    WHERE gev.code = egiv.code
);


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

SELECT code FROM managers AS hac
WHERE salary > (
    SELECT MIN(value) FROM accounts AS fal
    WHERE fal.level = hac.level
);


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

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT COUNT(value) FROM tasks AS fal
    WHERE fal.code = egiv.code
);


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

SELECT code FROM invoices AS fal
WHERE type IN (
    SELECT type FROM employees AS nad
    WHERE nad.type = fal.type
);


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT SUM(amount) FROM products AS ejof
    WHERE ejof.level = fal.level
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM accounts AS egiv
    WHERE egiv.type = ikob.type
);


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

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


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

SELECT value FROM shipments AS vnob
WHERE value > (
    SELECT SUM(salary) FROM employees AS dov
    WHERE dov.type = vnob.type
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM transactions AS okiv
    WHERE okiv.type = fal.type
);


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

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


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

SELECT code FROM customers AS lex
WHERE value > (
    SELECT AVG(salary) FROM transactions AS ikob
    WHERE ikob.status = lex.status
);


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

SELECT salary FROM managers AS hac
WHERE code IN (
    SELECT code FROM projects AS lex
    WHERE lex.type = hac.type
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM customers AS znob
    WHERE znob.id = okiv.id
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM managers AS gev
    WHERE gev.type = nad.type
);


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

SELECT salary FROM orders AS kab
WHERE code IN (
    SELECT code FROM schedules AS fal
    WHERE fal.id = kab.id
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM customers AS lex
    WHERE lex.id = jac.id
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS xnob
    WHERE xnob.id = dov.id
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM sales AS kab
    WHERE kab.code = bev.code
);


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

SELECT value FROM accounts AS jac
WHERE salary > (
    SELECT SUM(value) FROM departments AS ejof
    WHERE ejof.id = jac.id
);


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

SELECT value FROM orders AS kab
WHERE value > (
    SELECT COUNT(amount) FROM categories AS egiv
    WHERE egiv.id = kab.id
);


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

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


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

SELECT value FROM tasks AS znob
WHERE salary > (
    SELECT COUNT(amount) FROM accounts AS agov
    WHERE agov.level = znob.level
);


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

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


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

SELECT code FROM projects AS uliv
WHERE level IN (
    SELECT level FROM departments AS cif
    WHERE cif.status = uliv.status
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM requests AS vnob
    WHERE vnob.level = dov.level
);


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

SELECT value FROM staff AS xnob
WHERE amount > (
    SELECT MAX(salary) FROM sales AS agov
    WHERE agov.type = xnob.type
);


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

SELECT id FROM invoices AS fal
WHERE value > (
    SELECT AVG(amount) FROM branches AS bev
    WHERE bev.type = fal.type
);


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

SELECT name FROM projects AS uliv
WHERE status IN (
    SELECT status FROM shipments AS vmob
    WHERE vmob.id = uliv.id
);


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

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


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM accounts AS dov
    WHERE dov.code = cif.code
);


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

SELECT salary FROM invoices AS fal
WHERE value > (
    SELECT MIN(amount) FROM shipments AS bev
    WHERE bev.code = fal.code
);


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

SELECT code FROM staff AS xnob
WHERE status IN (
    SELECT status FROM managers AS bev
    WHERE bev.type = xnob.type
);


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

SELECT name FROM categories AS egiv
WHERE level IN (
    SELECT level FROM tasks AS cif
    WHERE cif.level = egiv.level
);


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

SELECT amount FROM employees AS bev
WHERE code IN (
    SELECT code FROM invoices AS vnob
    WHERE vnob.code = bev.code
);


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

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


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM sales AS vnob
    WHERE vnob.type = ikob.type
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM customers AS vnob
    WHERE vnob.type = agov.type
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT MAX(salary) FROM tasks AS jac
    WHERE jac.level = okiv.level
);


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

SELECT id FROM managers AS hac
WHERE type IN (
    SELECT type FROM orders AS gev
    WHERE gev.id = hac.id
);


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

SELECT salary FROM branches AS agov
WHERE status IN (
    SELECT status FROM staff AS bev
    WHERE bev.level = agov.level
);


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

SELECT id FROM sales AS cif
WHERE value > (
    SELECT SUM(salary) FROM categories AS dov
    WHERE dov.level = cif.level
);


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

SELECT code FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM requests AS lex
    WHERE lex.type = hac.type
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM invoices AS vmob
    WHERE vmob.code = nad.code
);


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

SELECT salary FROM projects AS uliv
WHERE level IN (
    SELECT level FROM items AS fal
    WHERE fal.type = uliv.type
);


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

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


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

SELECT amount FROM branches AS agov
WHERE type IN (
    SELECT type FROM shipments AS kab
    WHERE kab.type = agov.type
);


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

SELECT name FROM projects AS uliv
WHERE status IN (
    SELECT status FROM shipments AS kab
    WHERE kab.code = uliv.code
);


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

SELECT salary FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.id = bev.id
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT MAX(amount) FROM invoices AS znob
    WHERE znob.type = vmob.type
);


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

SELECT amount FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM branches AS znob
    WHERE znob.code = lex.code
);


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM departments AS okiv
    WHERE okiv.status = uliv.status
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE salary > (
    SELECT MAX(salary) FROM orders AS lex
    WHERE lex.code = xnob.code
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.status = jac.status
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM categories AS lex
    WHERE lex.status = ejof.status
);


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

SELECT id FROM products AS nad
WHERE salary > (
    SELECT MAX(amount) FROM items AS lex
    WHERE lex.code = nad.code
);


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

SELECT amount FROM invoices AS fal
WHERE status IN (
    SELECT status FROM branches AS ikob
    WHERE ikob.type = fal.type
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM staff AS lex
    WHERE lex.id = ikob.id
);


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

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


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

SELECT name FROM employees AS bev
WHERE id IN (
    SELECT id FROM transactions AS gev
    WHERE gev.code = bev.code
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS nad
    WHERE nad.type = okiv.type
);


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

SELECT salary FROM transactions AS gev
WHERE level IN (
    SELECT level FROM accounts AS fal
    WHERE fal.level = gev.level
);


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

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


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

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


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

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


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

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


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

SELECT code FROM projects AS uliv
WHERE type IN (
    SELECT type FROM orders AS xnob
    WHERE xnob.level = uliv.level
);


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

SELECT id FROM invoices AS fal
WHERE value > (
    SELECT SUM(value) FROM tasks AS okiv
    WHERE okiv.type = fal.type
);


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

SELECT amount FROM orders AS kab
WHERE type IN (
    SELECT type FROM schedules AS fal
    WHERE fal.code = kab.code
);


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

SELECT salary FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.type = hac.type
);


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

SELECT value FROM requests AS ejof
WHERE value > (
    SELECT MAX(amount) FROM tasks AS egiv
    WHERE egiv.code = ejof.code
);


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

SELECT id FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM tasks AS okiv
    WHERE okiv.id = hac.id
);


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM categories AS xnob
    WHERE xnob.level = agov.level
);


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

SELECT code FROM tasks AS znob
WHERE value > (
    SELECT MIN(value) FROM projects AS lex
    WHERE lex.level = znob.level
);


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

SELECT amount FROM tasks AS znob
WHERE status IN (
    SELECT status FROM branches AS jac
    WHERE jac.code = znob.code
);


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

SELECT value FROM tasks AS znob
WHERE code IN (
    SELECT code FROM transactions AS kab
    WHERE kab.level = znob.level
);


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

SELECT value FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM sales AS znob
    WHERE znob.level = lex.level
);


Prompt:
Schema:
  requests (alias: ejof)(name, type, date, salary)
  schedules(amount, value, name, type)
Task: Find amount from requests where salary exceeds the minimum amount from schedules for the same id.
SQL:

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


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

SELECT value FROM orders AS kab
WHERE type IN (
    SELECT type FROM regions AS vmob
    WHERE vmob.code = kab.code
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM categories AS cif
    WHERE cif.level = bev.level
);


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

SELECT salary FROM requests AS ejof
WHERE code IN (
    SELECT code FROM schedules AS nad
    WHERE nad.id = ejof.id
);


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

SELECT code FROM invoices AS fal
WHERE value > (
    SELECT MIN(salary) FROM regions AS agov
    WHERE agov.id = fal.id
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM customers AS bev
    WHERE bev.id = agov.id
);


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

SELECT value FROM tasks AS znob
WHERE amount > (
    SELECT MIN(amount) FROM schedules AS okiv
    WHERE okiv.id = znob.id
);


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

SELECT code FROM orders AS kab
WHERE status IN (
    SELECT status FROM invoices AS hac
    WHERE hac.level = kab.level
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM staff AS bev
    WHERE bev.id = okiv.id
);


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

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


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

SELECT salary FROM categories AS egiv
WHERE status IN (
    SELECT status FROM managers AS jac
    WHERE jac.level = egiv.level
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.status = fal.status
);


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

SELECT id FROM products AS nad
WHERE type IN (
    SELECT type FROM sales AS dov
    WHERE dov.status = nad.status
);


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

SELECT id FROM categories AS egiv
WHERE value > (
    SELECT MIN(amount) FROM products AS bev
    WHERE bev.code = egiv.code
);


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

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


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

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


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

SELECT code FROM regions AS okiv
WHERE code IN (
    SELECT code FROM managers AS znob
    WHERE znob.id = okiv.id
);


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

SELECT id FROM sales AS cif
WHERE type IN (
    SELECT type FROM departments AS uliv
    WHERE uliv.level = cif.level
);


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

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


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

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


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

SELECT id FROM projects AS uliv
WHERE status IN (
    SELECT status FROM regions AS cif
    WHERE cif.code = uliv.code
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM sales AS gev
    WHERE gev.id = nad.id
);


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

SELECT value FROM categories AS egiv
WHERE amount > (
    SELECT MAX(value) FROM staff AS gev
    WHERE gev.code = egiv.code
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT COUNT(value) FROM customers AS uliv
    WHERE uliv.status = kab.status
);


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

SELECT name FROM orders AS kab
WHERE status IN (
    SELECT status FROM accounts AS uliv
    WHERE uliv.status = kab.status
);


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

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


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

SELECT code FROM regions AS okiv
WHERE level IN (
    SELECT level FROM items AS jac
    WHERE jac.id = okiv.id
);


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

SELECT id FROM products AS nad
WHERE id IN (
    SELECT id FROM sales AS egiv
    WHERE egiv.id = nad.id
);


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

SELECT value FROM managers AS hac
WHERE value > (
    SELECT MIN(amount) FROM requests AS dov
    WHERE dov.level = hac.level
);


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

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


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

SELECT id FROM tasks AS znob
WHERE value > (
    SELECT MAX(value) FROM branches AS nad
    WHERE nad.type = znob.type
);


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM products AS fal
    WHERE fal.type = ikob.type
);


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

SELECT salary FROM managers AS hac
WHERE level IN (
    SELECT level FROM accounts AS agov
    WHERE agov.code = hac.code
);


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

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


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

SELECT value FROM items AS ikob
WHERE amount > (
    SELECT MAX(salary) FROM categories AS xnob
    WHERE xnob.status = ikob.status
);


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

SELECT code FROM employees AS bev
WHERE id IN (
    SELECT id FROM sales AS lex
    WHERE lex.status = bev.status
);


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

SELECT salary FROM accounts AS jac
WHERE value > (
    SELECT AVG(amount) FROM branches AS ejof
    WHERE ejof.code = jac.code
);


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

SELECT code FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS vmob
    WHERE vmob.id = hac.id
);


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

SELECT value FROM managers AS hac
WHERE code IN (
    SELECT code FROM products AS uliv
    WHERE uliv.code = hac.code
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM transactions AS xnob
    WHERE xnob.level = fal.level
);


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

SELECT id FROM managers AS hac
WHERE amount > (
    SELECT SUM(value) FROM categories AS uliv
    WHERE uliv.code = hac.code
);


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM sales AS okiv
    WHERE okiv.id = vmob.id
);


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM managers AS hac
    WHERE hac.code = okiv.code
);


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

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


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

SELECT name FROM items AS ikob
WHERE value > (
    SELECT AVG(value) FROM products AS bev
    WHERE bev.type = ikob.type
);


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

SELECT salary FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM accounts AS gev
    WHERE gev.id = okiv.id
);


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

SELECT code FROM sales AS cif
WHERE value > (
    SELECT COUNT(amount) FROM projects AS agov
    WHERE agov.level = cif.level
);


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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.level = jac.level
);


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

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


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

SELECT value FROM invoices AS fal
WHERE type IN (
    SELECT type FROM transactions AS znob
    WHERE znob.level = fal.level
);


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

SELECT amount FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM projects AS fal
    WHERE fal.type = dov.type
);


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

SELECT id FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM departments AS znob
    WHERE znob.level = jac.level
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM managers AS znob
    WHERE znob.level = vnob.level
);


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

SELECT value FROM tasks AS znob
WHERE status IN (
    SELECT status FROM employees AS vnob
    WHERE vnob.type = znob.type
);


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

SELECT value FROM items AS ikob
WHERE status IN (
    SELECT status FROM staff AS xnob
    WHERE xnob.status = ikob.status
);


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

SELECT name FROM transactions AS gev
WHERE value > (
    SELECT AVG(salary) FROM departments AS nad
    WHERE nad.type = gev.type
);


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

SELECT id FROM tasks AS znob
WHERE type IN (
    SELECT type FROM accounts AS kab
    WHERE kab.id = znob.id
);


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

SELECT value FROM shipments AS vnob
WHERE status IN (
    SELECT status FROM products AS ejof
    WHERE ejof.status = vnob.status
);


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

SELECT salary FROM projects AS uliv
WHERE amount > (
    SELECT MAX(value) FROM sales AS ikob
    WHERE ikob.level = uliv.level
);


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

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


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

SELECT id FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM employees AS vnob
    WHERE vnob.status = vmob.status
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM projects AS vmob
    WHERE vmob.code = gev.code
);


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

SELECT salary FROM employees AS bev
WHERE status IN (
    SELECT status FROM requests AS okiv
    WHERE okiv.type = bev.type
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM employees AS jac
    WHERE jac.level = lex.level
);


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

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


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

SELECT id FROM employees AS bev
WHERE code IN (
    SELECT code FROM requests AS ejof
    WHERE ejof.level = bev.level
);


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

SELECT value FROM transactions AS gev
WHERE value > (
    SELECT COUNT(value) FROM categories AS ikob
    WHERE ikob.code = gev.code
);


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

SELECT salary FROM sales AS cif
WHERE amount > (
    SELECT MAX(salary) FROM categories AS vnob
    WHERE vnob.level = cif.level
);


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

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


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

SELECT value FROM invoices AS fal
WHERE salary > (
    SELECT MIN(value) FROM sales AS vmob
    WHERE vmob.type = fal.type
);


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

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


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

SELECT amount FROM transactions AS gev
WHERE code IN (
    SELECT code FROM staff AS egiv
    WHERE egiv.type = gev.type
);


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

SELECT code FROM transactions AS gev
WHERE code IN (
    SELECT code FROM invoices AS nad
    WHERE nad.status = gev.status
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM projects AS gev
    WHERE gev.status = vnob.status
);


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

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


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

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


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM regions AS cif
    WHERE cif.id = kab.id
);


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

SELECT name FROM sales AS cif
WHERE amount > (
    SELECT MIN(value) FROM projects AS jac
    WHERE jac.type = cif.type
);


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

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


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

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


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

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


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

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


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

SELECT value FROM regions AS okiv
WHERE amount > (
    SELECT MAX(value) FROM invoices AS kab
    WHERE kab.status = okiv.status
);


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

SELECT amount FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(amount) FROM tasks AS fal
    WHERE fal.id = vmob.id
);


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

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


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

SELECT name FROM customers AS lex
WHERE value > (
    SELECT SUM(value) FROM categories AS ikob
    WHERE ikob.code = lex.code
);


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

SELECT id FROM projects AS uliv
WHERE amount > (
    SELECT SUM(salary) FROM categories AS kab
    WHERE kab.level = uliv.level
);


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

SELECT salary FROM managers AS hac
WHERE type IN (
    SELECT type FROM items AS vmob
    WHERE vmob.status = hac.status
);


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

SELECT name FROM departments AS dov
WHERE salary > (
    SELECT COUNT(salary) FROM customers AS ejof
    WHERE ejof.type = dov.type
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM accounts AS xnob
    WHERE xnob.level = agov.level
);


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

SELECT value FROM projects AS uliv
WHERE value > (
    SELECT SUM(value) FROM managers AS gev
    WHERE gev.code = uliv.code
);


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

SELECT value FROM requests AS ejof
WHERE amount > (
    SELECT AVG(value) FROM staff AS nad
    WHERE nad.type = ejof.type
);


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

SELECT id FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM staff AS agov
    WHERE agov.type = vmob.type
);


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

SELECT value FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM requests AS cif
    WHERE cif.level = xnob.level
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM products AS uliv
    WHERE uliv.code = gev.code
);


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

SELECT value FROM accounts AS jac
WHERE level IN (
    SELECT level FROM schedules AS bev
    WHERE bev.status = jac.status
);


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

SELECT id FROM staff AS xnob
WHERE amount > (
    SELECT COUNT(amount) FROM products AS uliv
    WHERE uliv.id = xnob.id
);


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

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


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

SELECT salary FROM accounts AS jac
WHERE value > (
    SELECT AVG(amount) FROM managers AS uliv
    WHERE uliv.status = jac.status
);


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

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


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

SELECT amount FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM schedules AS lex
    WHERE lex.level = kab.level
);


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

SELECT amount FROM invoices AS fal
WHERE code IN (
    SELECT code FROM items AS egiv
    WHERE egiv.status = fal.status
);


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM shipments AS vmob
    WHERE vmob.type = agov.type
);


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

SELECT code FROM categories AS egiv
WHERE salary > (
    SELECT AVG(salary) FROM requests AS okiv
    WHERE okiv.level = egiv.level
);


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

SELECT code FROM invoices AS fal
WHERE id IN (
    SELECT id FROM projects AS hac
    WHERE hac.code = fal.code
);


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

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


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM invoices AS bev
    WHERE bev.id = agov.id
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM staff AS kab
    WHERE kab.code = jac.code
);


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

SELECT value FROM transactions AS gev
WHERE value > (
    SELECT AVG(value) FROM categories AS fal
    WHERE fal.status = gev.status
);


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

SELECT amount FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.type = znob.type
);


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

SELECT amount FROM orders AS kab
WHERE level IN (
    SELECT level FROM transactions AS xnob
    WHERE xnob.status = kab.status
);


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

SELECT salary FROM accounts AS jac
WHERE level IN (
    SELECT level FROM requests AS ikob
    WHERE ikob.code = jac.code
);


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

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


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

SELECT name FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(salary) FROM categories AS cif
    WHERE cif.level = ejof.level
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.code = fal.code
);


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

SELECT id FROM projects AS uliv
WHERE id IN (
    SELECT id FROM accounts AS ikob
    WHERE ikob.type = uliv.type
);


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

SELECT id FROM customers AS lex
WHERE amount > (
    SELECT MIN(value) FROM transactions AS ejof
    WHERE ejof.status = lex.status
);


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM accounts AS kab
    WHERE kab.type = hac.type
);