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

SELECT name FROM employees AS bev
WHERE type IN (
    SELECT type FROM transactions AS fal
    WHERE fal.level = bev.level
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS agov
    WHERE agov.status = vnob.status
);


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

SELECT amount FROM departments AS dov
WHERE type IN (
    SELECT type FROM accounts AS uliv
    WHERE uliv.id = dov.id
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM managers AS znob
    WHERE znob.level = okiv.level
);


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

SELECT value FROM orders AS kab
WHERE salary > (
    SELECT SUM(amount) FROM sales AS hac
    WHERE hac.status = kab.status
);


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

SELECT value FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM customers AS xnob
    WHERE xnob.level = vmob.level
);


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

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


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

SELECT amount FROM products AS nad
WHERE status IN (
    SELECT status FROM requests AS agov
    WHERE agov.status = nad.status
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS znob
    WHERE znob.id = xnob.id
);


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM managers AS ikob
    WHERE ikob.code = gev.code
);


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

SELECT id FROM departments AS dov
WHERE type IN (
    SELECT type FROM staff AS kab
    WHERE kab.level = dov.level
);


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

SELECT value FROM invoices AS fal
WHERE status IN (
    SELECT status FROM sales AS nad
    WHERE nad.id = fal.id
);


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

SELECT code FROM regions AS okiv
WHERE salary > (
    SELECT MAX(salary) FROM products AS vmob
    WHERE vmob.status = okiv.status
);


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

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


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

SELECT name FROM requests AS ejof
WHERE id IN (
    SELECT id FROM tasks AS hac
    WHERE hac.status = ejof.status
);


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

SELECT amount FROM requests AS ejof
WHERE level IN (
    SELECT level FROM departments AS jac
    WHERE jac.code = ejof.code
);


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

SELECT name FROM regions AS okiv
WHERE id IN (
    SELECT id FROM products AS jac
    WHERE jac.level = okiv.level
);


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

SELECT code FROM projects AS uliv
WHERE level IN (
    SELECT level FROM products AS hac
    WHERE hac.status = uliv.status
);


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

SELECT salary FROM accounts AS jac
WHERE id IN (
    SELECT id FROM regions AS znob
    WHERE znob.level = jac.level
);


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

SELECT value FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM tasks AS egiv
    WHERE egiv.status = vmob.status
);


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT SUM(value) FROM accounts AS agov
    WHERE agov.level = fal.level
);


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

SELECT value FROM sales AS cif
WHERE code IN (
    SELECT code FROM schedules AS okiv
    WHERE okiv.id = cif.id
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM projects AS xnob
    WHERE xnob.code = ikob.code
);


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

SELECT salary FROM branches AS agov
WHERE level IN (
    SELECT level FROM staff AS jac
    WHERE jac.id = agov.id
);


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

SELECT value FROM requests AS ejof
WHERE level IN (
    SELECT level FROM transactions AS hac
    WHERE hac.id = ejof.id
);


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

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


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM regions AS hac
    WHERE hac.level = egiv.level
);


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

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


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS cif
    WHERE cif.type = hac.type
);


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

SELECT value FROM products AS nad
WHERE salary > (
    SELECT COUNT(amount) FROM requests AS jac
    WHERE jac.code = nad.code
);


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

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


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM products AS kab
    WHERE kab.type = lex.type
);


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

SELECT amount FROM sales AS cif
WHERE salary > (
    SELECT COUNT(value) FROM departments AS gev
    WHERE gev.code = cif.code
);


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

SELECT name FROM customers AS lex
WHERE value > (
    SELECT COUNT(value) FROM projects AS vnob
    WHERE vnob.level = lex.level
);


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

SELECT id FROM managers AS hac
WHERE value > (
    SELECT MIN(amount) FROM projects AS gev
    WHERE gev.id = hac.id
);


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

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT SUM(amount) FROM categories AS ejof
    WHERE ejof.type = vmob.type
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM projects AS gev
    WHERE gev.status = ikob.status
);


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

SELECT name FROM sales AS cif
WHERE id IN (
    SELECT id FROM shipments AS ejof
    WHERE ejof.type = cif.type
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM orders AS agov
    WHERE agov.code = hac.code
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM categories AS vmob
    WHERE vmob.level = vnob.level
);


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

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


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.id = ikob.id
);


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

SELECT salary FROM schedules AS vmob
WHERE amount > (
    SELECT MIN(amount) FROM orders AS cif
    WHERE cif.level = vmob.level
);


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

SELECT name FROM orders AS kab
WHERE status IN (
    SELECT status FROM invoices AS bev
    WHERE bev.code = kab.code
);


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

SELECT value FROM managers AS hac
WHERE salary > (
    SELECT COUNT(amount) FROM sales AS dov
    WHERE dov.level = hac.level
);


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

SELECT name FROM managers AS hac
WHERE id IN (
    SELECT id FROM shipments AS ikob
    WHERE ikob.level = hac.level
);


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

SELECT value FROM schedules AS vmob
WHERE value > (
    SELECT MIN(amount) FROM products AS dov
    WHERE dov.status = vmob.status
);


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

SELECT name FROM products AS nad
WHERE amount > (
    SELECT COUNT(value) FROM schedules AS dov
    WHERE dov.status = nad.status
);


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

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


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

SELECT amount FROM orders AS kab
WHERE salary > (
    SELECT SUM(value) FROM sales AS okiv
    WHERE okiv.type = kab.type
);


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

SELECT amount FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM categories AS vmob
    WHERE vmob.id = vnob.id
);


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

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


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

SELECT id FROM customers AS lex
WHERE amount > (
    SELECT AVG(value) FROM products AS okiv
    WHERE okiv.level = lex.level
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM items AS gev
    WHERE gev.id = ejof.id
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM orders AS dov
    WHERE dov.type = vnob.type
);


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

SELECT name FROM products AS nad
WHERE level IN (
    SELECT level FROM categories AS jac
    WHERE jac.code = nad.code
);


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

SELECT value FROM orders AS kab
WHERE value > (
    SELECT AVG(amount) FROM regions AS vnob
    WHERE vnob.status = kab.status
);


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

SELECT salary FROM customers AS lex
WHERE salary > (
    SELECT SUM(value) FROM employees AS znob
    WHERE znob.level = lex.level
);


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

SELECT salary FROM regions AS okiv
WHERE salary > (
    SELECT MIN(salary) FROM tasks AS dov
    WHERE dov.status = okiv.status
);


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

SELECT salary FROM tasks AS znob
WHERE type IN (
    SELECT type FROM orders AS vnob
    WHERE vnob.status = znob.status
);


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

SELECT amount FROM sales AS cif
WHERE status IN (
    SELECT status FROM invoices AS gev
    WHERE gev.id = cif.id
);


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

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


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

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


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

SELECT amount FROM categories AS egiv
WHERE level IN (
    SELECT level FROM customers AS jac
    WHERE jac.type = egiv.type
);


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

SELECT amount FROM schedules AS vmob
WHERE amount > (
    SELECT SUM(amount) FROM staff AS xnob
    WHERE xnob.code = vmob.code
);


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

SELECT salary FROM orders AS kab
WHERE level IN (
    SELECT level FROM employees AS vmob
    WHERE vmob.id = kab.id
);


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

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


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

SELECT name FROM managers AS hac
WHERE salary > (
    SELECT COUNT(salary) FROM departments AS lex
    WHERE lex.code = hac.code
);


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

SELECT name FROM products AS nad
WHERE amount > (
    SELECT COUNT(salary) FROM employees AS xnob
    WHERE xnob.level = nad.level
);


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

SELECT name FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM accounts AS nad
    WHERE nad.code = vmob.code
);


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

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


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

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


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

SELECT id FROM transactions AS gev
WHERE level IN (
    SELECT level FROM items AS xnob
    WHERE xnob.id = gev.id
);


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

SELECT value FROM categories AS egiv
WHERE level IN (
    SELECT level FROM invoices AS ikob
    WHERE ikob.code = egiv.code
);


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

SELECT value FROM employees AS bev
WHERE code IN (
    SELECT code FROM tasks AS ejof
    WHERE ejof.status = bev.status
);


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

SELECT id FROM employees AS bev
WHERE level IN (
    SELECT level FROM customers AS vmob
    WHERE vmob.level = bev.level
);


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

SELECT salary FROM regions AS okiv
WHERE code IN (
    SELECT code FROM projects AS agov
    WHERE agov.type = okiv.type
);


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

SELECT name FROM regions AS okiv
WHERE amount > (
    SELECT MAX(salary) FROM products AS xnob
    WHERE xnob.code = okiv.code
);


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

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


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

SELECT value FROM departments AS dov
WHERE value > (
    SELECT MAX(value) FROM regions AS jac
    WHERE jac.code = dov.code
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS vnob
    WHERE vnob.type = fal.type
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM departments AS xnob
    WHERE xnob.id = agov.id
);


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

SELECT name FROM invoices AS fal
WHERE status IN (
    SELECT status FROM categories AS cif
    WHERE cif.id = fal.id
);


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

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


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

SELECT amount FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM customers AS okiv
    WHERE okiv.level = uliv.level
);


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

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


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

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


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM requests AS xnob
    WHERE xnob.code = vmob.code
);


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

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


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

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


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

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


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM accounts AS uliv
    WHERE uliv.level = fal.level
);


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

SELECT value FROM shipments AS vnob
WHERE type IN (
    SELECT type FROM accounts AS okiv
    WHERE okiv.type = vnob.type
);


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

SELECT name FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM categories AS ikob
    WHERE ikob.status = vnob.status
);


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

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


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

SELECT salary FROM employees AS bev
WHERE salary > (
    SELECT AVG(salary) FROM accounts AS ejof
    WHERE ejof.status = bev.status
);


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

SELECT code FROM branches AS agov
WHERE type IN (
    SELECT type FROM shipments AS uliv
    WHERE uliv.code = agov.code
);


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

SELECT name FROM departments AS dov
WHERE id IN (
    SELECT id FROM customers AS nad
    WHERE nad.level = dov.level
);


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

SELECT id FROM employees AS bev
WHERE id IN (
    SELECT id FROM regions AS znob
    WHERE znob.level = bev.level
);


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

SELECT code FROM categories AS egiv
WHERE salary > (
    SELECT AVG(value) FROM accounts AS okiv
    WHERE okiv.type = egiv.type
);


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

SELECT name FROM products AS nad
WHERE amount > (
    SELECT AVG(salary) FROM branches AS ejof
    WHERE ejof.id = nad.id
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.code = egiv.code
);


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

SELECT id FROM staff AS xnob
WHERE value > (
    SELECT MIN(amount) FROM requests AS ikob
    WHERE ikob.level = xnob.level
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM branches AS hac
    WHERE hac.level = ejof.level
);


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

SELECT value FROM categories AS egiv
WHERE id IN (
    SELECT id FROM customers AS nad
    WHERE nad.code = egiv.code
);


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

SELECT code FROM tasks AS znob
WHERE status IN (
    SELECT status FROM customers AS egiv
    WHERE egiv.type = znob.type
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.code = xnob.code
);


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

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


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

SELECT amount FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM regions AS bev
    WHERE bev.level = cif.level
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM transactions AS znob
    WHERE znob.id = vmob.id
);


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

SELECT amount FROM transactions AS gev
WHERE level IN (
    SELECT level FROM shipments AS hac
    WHERE hac.status = gev.status
);


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

SELECT id FROM transactions AS gev
WHERE amount > (
    SELECT AVG(amount) FROM regions AS ikob
    WHERE ikob.type = gev.type
);


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

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


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

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


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

SELECT id FROM projects AS uliv
WHERE value > (
    SELECT COUNT(value) FROM customers AS jac
    WHERE jac.type = uliv.type
);


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

SELECT salary FROM projects AS uliv
WHERE value > (
    SELECT COUNT(amount) FROM staff AS fal
    WHERE fal.level = uliv.level
);


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

SELECT value FROM branches AS agov
WHERE id IN (
    SELECT id FROM staff AS kab
    WHERE kab.type = agov.type
);


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

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


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

SELECT amount FROM items AS ikob
WHERE status IN (
    SELECT status FROM regions AS xnob
    WHERE xnob.id = ikob.id
);


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

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


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

SELECT salary FROM regions AS okiv
WHERE salary > (
    SELECT COUNT(value) FROM products AS bev
    WHERE bev.id = okiv.id
);


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

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


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

SELECT value FROM departments AS dov
WHERE type IN (
    SELECT type FROM projects AS ejof
    WHERE ejof.status = dov.status
);


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

SELECT id FROM departments AS dov
WHERE id IN (
    SELECT id FROM staff AS xnob
    WHERE xnob.level = dov.level
);


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM employees AS kab
    WHERE kab.code = egiv.code
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM sales AS cif
    WHERE cif.type = hac.type
);


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

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


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

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


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

SELECT value FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM shipments AS ejof
    WHERE ejof.level = vmob.level
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM sales AS jac
    WHERE jac.id = xnob.id
);


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

SELECT code FROM sales AS cif
WHERE amount > (
    SELECT SUM(amount) FROM invoices AS uliv
    WHERE uliv.level = cif.level
);


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

SELECT salary FROM customers AS lex
WHERE code IN (
    SELECT code FROM employees AS cif
    WHERE cif.status = lex.status
);


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

SELECT name FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM regions AS cif
    WHERE cif.code = fal.code
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM orders AS okiv
    WHERE okiv.code = uliv.code
);


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

SELECT amount FROM requests AS ejof
WHERE amount > (
    SELECT SUM(amount) FROM schedules AS bev
    WHERE bev.id = ejof.id
);


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

SELECT code FROM customers AS lex
WHERE amount > (
    SELECT MIN(amount) FROM regions AS xnob
    WHERE xnob.type = lex.type
);


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

SELECT name FROM customers AS lex
WHERE status IN (
    SELECT status FROM orders AS okiv
    WHERE okiv.level = lex.level
);


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

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


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM requests AS fal
    WHERE fal.type = vmob.type
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM requests AS uliv
    WHERE uliv.type = xnob.type
);


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

SELECT salary FROM invoices AS fal
WHERE amount > (
    SELECT MAX(salary) FROM employees AS okiv
    WHERE okiv.code = fal.code
);


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

SELECT code FROM orders AS kab
WHERE code IN (
    SELECT code FROM customers AS gev
    WHERE gev.code = kab.code
);


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

SELECT name FROM products AS nad
WHERE level IN (
    SELECT level FROM invoices AS egiv
    WHERE egiv.id = nad.id
);


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

SELECT value FROM orders AS kab
WHERE code IN (
    SELECT code FROM schedules AS nad
    WHERE nad.id = kab.id
);


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

SELECT value FROM invoices AS fal
WHERE status IN (
    SELECT status FROM tasks AS okiv
    WHERE okiv.code = fal.code
);


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

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


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

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


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM transactions AS hac
    WHERE hac.type = uliv.type
);


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

SELECT code FROM departments AS dov
WHERE level IN (
    SELECT level FROM projects AS agov
    WHERE agov.level = dov.level
);


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM items AS kab
    WHERE kab.code = lex.code
);


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

SELECT amount FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM products AS hac
    WHERE hac.id = vmob.id
);


Prompt:
Schema:
  orders (alias: kab)(value, id, date, type)
  schedules(id, name, amount, 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 cif
    WHERE cif.level = kab.level
);


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

SELECT salary FROM projects AS uliv
WHERE code IN (
    SELECT code FROM customers AS gev
    WHERE gev.id = uliv.id
);


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

SELECT code FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM items AS znob
    WHERE znob.type = jac.type
);


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

SELECT salary FROM transactions AS gev
WHERE value > (
    SELECT COUNT(value) FROM projects AS fal
    WHERE fal.type = gev.type
);


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

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


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM branches AS xnob
    WHERE xnob.code = uliv.code
);


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

SELECT code FROM branches AS agov
WHERE code IN (
    SELECT code FROM sales AS jac
    WHERE jac.status = agov.status
);


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

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


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

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


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

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


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

SELECT value FROM orders AS kab
WHERE level IN (
    SELECT level FROM projects AS egiv
    WHERE egiv.status = kab.status
);


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

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


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

SELECT name FROM departments AS dov
WHERE code IN (
    SELECT code FROM schedules AS lex
    WHERE lex.code = dov.code
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM employees AS egiv
    WHERE egiv.type = ejof.type
);


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

SELECT value FROM tasks AS znob
WHERE level IN (
    SELECT level FROM requests AS hac
    WHERE hac.level = znob.level
);


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

SELECT salary FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM departments AS lex
    WHERE lex.status = ikob.status
);


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

SELECT salary FROM requests AS ejof
WHERE salary > (
    SELECT SUM(amount) FROM sales AS uliv
    WHERE uliv.status = ejof.status
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM customers AS xnob
    WHERE xnob.level = bev.level
);


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

SELECT id FROM accounts AS jac
WHERE code IN (
    SELECT code FROM customers AS uliv
    WHERE uliv.level = jac.level
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM customers AS okiv
    WHERE okiv.code = gev.code
);


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

SELECT value FROM invoices AS fal
WHERE level IN (
    SELECT level FROM tasks AS xnob
    WHERE xnob.type = fal.type
);


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

SELECT name FROM transactions AS gev
WHERE status IN (
    SELECT status FROM managers AS egiv
    WHERE egiv.id = gev.id
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM products AS lex
    WHERE lex.status = vnob.status
);


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

SELECT code FROM managers AS hac
WHERE amount > (
    SELECT MAX(salary) FROM shipments AS bev
    WHERE bev.type = hac.type
);


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

SELECT id FROM tasks AS znob
WHERE value > (
    SELECT AVG(amount) FROM schedules AS hac
    WHERE hac.level = znob.level
);


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

SELECT salary FROM employees AS bev
WHERE id IN (
    SELECT id FROM projects AS kab
    WHERE kab.status = bev.status
);


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

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


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

SELECT salary FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM invoices AS agov
    WHERE agov.type = uliv.type
);


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

SELECT value FROM sales AS cif
WHERE type IN (
    SELECT type FROM tasks AS kab
    WHERE kab.level = cif.level
);


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

SELECT id FROM regions AS okiv
WHERE amount > (
    SELECT AVG(salary) FROM requests AS agov
    WHERE agov.id = okiv.id
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM branches AS bev
    WHERE bev.type = ikob.type
);


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

SELECT value FROM schedules AS vmob
WHERE status IN (
    SELECT status FROM departments AS uliv
    WHERE uliv.status = vmob.status
);


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

SELECT code FROM managers AS hac
WHERE amount > (
    SELECT SUM(amount) FROM items AS kab
    WHERE kab.status = hac.status
);


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

SELECT salary FROM invoices AS fal
WHERE level IN (
    SELECT level FROM tasks AS kab
    WHERE kab.type = fal.type
);


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

SELECT salary FROM requests AS ejof
WHERE id IN (
    SELECT id FROM items AS vnob
    WHERE vnob.id = ejof.id
);


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

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


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM orders AS agov
    WHERE agov.level = nad.level
);


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

SELECT amount FROM staff AS xnob
WHERE level IN (
    SELECT level FROM categories AS hac
    WHERE hac.status = xnob.status
);


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

SELECT name FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM schedules AS znob
    WHERE znob.level = fal.level
);


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

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


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

SELECT value FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS fal
    WHERE fal.id = xnob.id
);


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

SELECT salary FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM products AS kab
    WHERE kab.id = vmob.id
);


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

SELECT id FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM categories AS uliv
    WHERE uliv.level = okiv.level
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM regions AS uliv
    WHERE uliv.type = nad.type
);


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

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


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

SELECT amount FROM projects AS uliv
WHERE status IN (
    SELECT status FROM invoices AS nad
    WHERE nad.level = uliv.level
);


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

SELECT amount FROM accounts AS jac
WHERE id IN (
    SELECT id FROM sales AS gev
    WHERE gev.id = jac.id
);


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

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


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

SELECT id FROM transactions AS gev
WHERE status IN (
    SELECT status FROM categories AS uliv
    WHERE uliv.id = gev.id
);


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

SELECT salary FROM staff AS xnob
WHERE salary > (
    SELECT COUNT(salary) FROM invoices AS bev
    WHERE bev.id = xnob.id
);


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

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


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

SELECT name FROM tasks AS znob
WHERE salary > (
    SELECT SUM(amount) FROM managers AS vmob
    WHERE vmob.status = znob.status
);


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

SELECT salary FROM categories AS egiv
WHERE level IN (
    SELECT level FROM staff AS vmob
    WHERE vmob.status = egiv.status
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM requests AS egiv
    WHERE egiv.status = bev.status
);


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

SELECT value FROM categories AS egiv
WHERE amount > (
    SELECT MIN(amount) FROM managers AS jac
    WHERE jac.type = egiv.type
);


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

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


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

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


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM managers AS egiv
    WHERE egiv.code = cif.code
);


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

SELECT code FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM products AS hac
    WHERE hac.level = kab.level
);


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

SELECT id FROM branches AS agov
WHERE value > (
    SELECT SUM(amount) FROM accounts AS vnob
    WHERE vnob.code = agov.code
);


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

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


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

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


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

SELECT salary FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM staff AS xnob
    WHERE xnob.type = lex.type
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM items AS vmob
    WHERE vmob.id = bev.id
);


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

SELECT name FROM employees AS bev
WHERE amount > (
    SELECT MAX(value) FROM accounts AS nad
    WHERE nad.status = bev.status
);


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

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


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

SELECT salary FROM staff AS xnob
WHERE salary > (
    SELECT SUM(salary) FROM customers AS vmob
    WHERE vmob.code = xnob.code
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM projects AS hac
    WHERE hac.type = xnob.type
);


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

SELECT amount FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM requests AS vmob
    WHERE vmob.type = kab.type
);


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

SELECT value FROM departments AS dov
WHERE value > (
    SELECT COUNT(salary) FROM products AS nad
    WHERE nad.type = dov.type
);


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

SELECT salary FROM sales AS cif
WHERE value > (
    SELECT MAX(salary) FROM categories AS hac
    WHERE hac.id = cif.id
);


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

SELECT salary FROM staff AS xnob
WHERE amount > (
    SELECT AVG(amount) FROM accounts AS znob
    WHERE znob.type = xnob.type
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM orders AS cif
    WHERE cif.status = uliv.status
);


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

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


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM schedules AS ikob
    WHERE ikob.type = okiv.type
);


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

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


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

SELECT name FROM tasks AS znob
WHERE level IN (
    SELECT level FROM orders AS vmob
    WHERE vmob.id = znob.id
);


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

SELECT amount FROM items AS ikob
WHERE level IN (
    SELECT level FROM products AS jac
    WHERE jac.status = ikob.status
);


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

SELECT value FROM projects AS uliv
WHERE status IN (
    SELECT status FROM orders AS ejof
    WHERE ejof.id = uliv.id
);


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

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


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

SELECT id FROM departments AS dov
WHERE amount > (
    SELECT AVG(value) FROM sales AS fal
    WHERE fal.status = dov.status
);


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

SELECT id FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.level = lex.level
);


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

SELECT value FROM categories AS egiv
WHERE type IN (
    SELECT type FROM employees AS ejof
    WHERE ejof.code = egiv.code
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM departments AS hac
    WHERE hac.level = uliv.level
);


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

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


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

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


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

SELECT value FROM shipments AS vnob
WHERE value > (
    SELECT MIN(value) FROM products AS uliv
    WHERE uliv.level = vnob.level
);


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

SELECT value FROM requests AS ejof
WHERE value > (
    SELECT MIN(amount) FROM accounts AS znob
    WHERE znob.code = ejof.code
);


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

SELECT name FROM employees AS bev
WHERE salary > (
    SELECT SUM(value) FROM sales AS okiv
    WHERE okiv.id = bev.id
);


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

SELECT name FROM managers AS hac
WHERE id IN (
    SELECT id FROM invoices AS ikob
    WHERE ikob.level = hac.level
);


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

SELECT id FROM staff AS xnob
WHERE type IN (
    SELECT type FROM products AS vnob
    WHERE vnob.type = xnob.type
);


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

SELECT name FROM branches AS agov
WHERE level IN (
    SELECT level FROM accounts AS cif
    WHERE cif.status = agov.status
);


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

SELECT code FROM employees AS bev
WHERE code IN (
    SELECT code FROM departments AS znob
    WHERE znob.code = bev.code
);


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

SELECT id FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM transactions AS gev
    WHERE gev.id = bev.id
);


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

SELECT salary FROM items AS ikob
WHERE amount > (
    SELECT SUM(salary) FROM managers AS bev
    WHERE bev.level = ikob.level
);


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

SELECT salary FROM schedules AS vmob
WHERE level IN (
    SELECT level FROM managers AS nad
    WHERE nad.level = vmob.level
);


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

SELECT id FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM categories AS xnob
    WHERE xnob.level = dov.level
);


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

SELECT salary FROM orders AS kab
WHERE salary > (
    SELECT COUNT(amount) FROM tasks AS dov
    WHERE dov.type = kab.type
);


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS agov
    WHERE agov.type = egiv.type
);


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

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


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

SELECT id FROM items AS ikob
WHERE status IN (
    SELECT status FROM shipments AS ejof
    WHERE ejof.code = ikob.code
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM invoices AS kab
    WHERE kab.code = agov.code
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT SUM(salary) FROM regions AS dov
    WHERE dov.id = jac.id
);


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

SELECT salary FROM departments AS dov
WHERE code IN (
    SELECT code FROM invoices AS ikob
    WHERE ikob.level = dov.level
);


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

SELECT code FROM customers AS lex
WHERE amount > (
    SELECT MIN(salary) FROM employees AS nad
    WHERE nad.level = lex.level
);


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

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


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

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


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

SELECT id FROM regions AS okiv
WHERE salary > (
    SELECT MAX(amount) FROM branches AS vmob
    WHERE vmob.level = okiv.level
);


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

SELECT amount FROM branches AS agov
WHERE amount > (
    SELECT SUM(salary) FROM sales AS dov
    WHERE dov.id = agov.id
);


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

SELECT value FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM branches AS kab
    WHERE kab.level = znob.level
);


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

SELECT code FROM branches AS agov
WHERE type IN (
    SELECT type FROM staff AS uliv
    WHERE uliv.level = agov.level
);


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

SELECT name FROM branches AS agov
WHERE id IN (
    SELECT id FROM categories AS kab
    WHERE kab.status = agov.status
);


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

SELECT amount FROM branches AS agov
WHERE code IN (
    SELECT code FROM products AS bev
    WHERE bev.level = agov.level
);


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

SELECT amount FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM orders AS cif
    WHERE cif.id = ikob.id
);


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

SELECT id FROM sales AS cif
WHERE code IN (
    SELECT code FROM staff AS vnob
    WHERE vnob.type = cif.type
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE amount > (
    SELECT SUM(value) FROM projects AS dov
    WHERE dov.level = fal.level
);


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

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


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

SELECT code FROM sales AS cif
WHERE amount > (
    SELECT AVG(value) FROM staff AS jac
    WHERE jac.code = cif.code
);


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

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


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

SELECT code FROM sales AS cif
WHERE id IN (
    SELECT id FROM invoices AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM shipments AS nad
    WHERE nad.type = dov.type
);


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

SELECT name FROM transactions AS gev
WHERE code IN (
    SELECT code FROM branches AS bev
    WHERE bev.status = gev.status
);


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

SELECT value FROM invoices AS fal
WHERE value > (
    SELECT COUNT(salary) FROM items AS znob
    WHERE znob.type = fal.type
);


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

SELECT amount FROM requests AS ejof
WHERE value > (
    SELECT AVG(salary) FROM departments AS kab
    WHERE kab.id = ejof.id
);


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

SELECT value FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM regions AS lex
    WHERE lex.status = fal.status
);


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

SELECT id FROM staff AS xnob
WHERE salary > (
    SELECT AVG(salary) FROM regions AS okiv
    WHERE okiv.id = xnob.id
);


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

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


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

SELECT salary FROM sales AS cif
WHERE id IN (
    SELECT id FROM products AS fal
    WHERE fal.type = cif.type
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM customers AS bev
    WHERE bev.type = gev.type
);


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

SELECT code FROM products AS nad
WHERE level IN (
    SELECT level FROM schedules AS dov
    WHERE dov.level = nad.level
);


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

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


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

SELECT id FROM accounts AS jac
WHERE code IN (
    SELECT code FROM sales AS dov
    WHERE dov.level = jac.level
);


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

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


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

SELECT code FROM customers AS lex
WHERE code IN (
    SELECT code FROM requests AS vmob
    WHERE vmob.code = lex.code
);


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

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


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

SELECT value FROM products AS nad
WHERE value > (
    SELECT COUNT(amount) FROM accounts AS fal
    WHERE fal.code = nad.code
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS ikob
    WHERE ikob.level = ejof.level
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM customers AS egiv
    WHERE egiv.code = hac.code
);


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

SELECT code FROM schedules AS vmob
WHERE value > (
    SELECT AVG(amount) FROM branches AS okiv
    WHERE okiv.id = vmob.id
);


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

SELECT name FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM products AS okiv
    WHERE okiv.type = znob.type
);


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

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


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

SELECT amount FROM departments AS dov
WHERE level IN (
    SELECT level FROM customers AS ejof
    WHERE ejof.status = dov.status
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM staff AS cif
    WHERE cif.level = dov.level
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM orders AS jac
    WHERE jac.level = vnob.level
);


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

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


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

SELECT amount FROM orders AS kab
WHERE level IN (
    SELECT level FROM tasks AS hac
    WHERE hac.status = kab.status
);