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

SELECT name FROM departments AS dov
WHERE value > (
    SELECT SUM(value) FROM categories AS jac
    WHERE jac.status = dov.status
);


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

SELECT code FROM products AS nad
WHERE salary > (
    SELECT COUNT(value) FROM projects AS hac
    WHERE hac.id = nad.id
);


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

SELECT code FROM staff AS xnob
WHERE level IN (
    SELECT level FROM tasks AS cif
    WHERE cif.id = xnob.id
);


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

SELECT value FROM orders AS kab
WHERE value > (
    SELECT MIN(value) FROM regions AS ikob
    WHERE ikob.id = kab.id
);


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM managers AS bev
    WHERE bev.level = okiv.level
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM tasks AS gev
    WHERE gev.type = dov.type
);


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

SELECT value FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM managers AS ejof
    WHERE ejof.code = vnob.code
);


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

SELECT value FROM accounts AS jac
WHERE amount > (
    SELECT MAX(salary) FROM staff AS vmob
    WHERE vmob.status = jac.status
);


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

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


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

SELECT id FROM employees AS bev
WHERE type IN (
    SELECT type FROM tasks AS hac
    WHERE hac.code = bev.code
);


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

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


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

SELECT code FROM customers AS lex
WHERE value > (
    SELECT MIN(value) FROM accounts AS uliv
    WHERE uliv.id = lex.id
);


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

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


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

SELECT salary FROM orders AS kab
WHERE amount > (
    SELECT AVG(salary) FROM regions AS fal
    WHERE fal.type = kab.type
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM products AS kab
    WHERE kab.id = hac.id
);


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

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


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

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


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

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


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

SELECT salary FROM accounts AS jac
WHERE level IN (
    SELECT level FROM projects AS hac
    WHERE hac.code = jac.code
);


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

SELECT value FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM employees AS ejof
    WHERE ejof.level = okiv.level
);


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

SELECT id FROM sales AS cif
WHERE status IN (
    SELECT status FROM shipments AS egiv
    WHERE egiv.id = cif.id
);


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

SELECT code FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS uliv
    WHERE uliv.type = okiv.type
);


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

SELECT code FROM branches AS agov
WHERE id IN (
    SELECT id FROM shipments AS cif
    WHERE cif.level = agov.level
);


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

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


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

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


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

SELECT salary FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM categories AS kab
    WHERE kab.level = jac.level
);


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

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


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

SELECT amount FROM products AS nad
WHERE type IN (
    SELECT type FROM schedules AS gev
    WHERE gev.code = nad.code
);


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

SELECT value FROM transactions AS gev
WHERE type IN (
    SELECT type FROM projects AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT code FROM staff AS xnob
WHERE code IN (
    SELECT code FROM categories AS jac
    WHERE jac.level = xnob.level
);


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

SELECT amount FROM projects AS uliv
WHERE salary > (
    SELECT SUM(value) FROM requests AS vnob
    WHERE vnob.status = uliv.status
);


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

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


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

SELECT salary FROM accounts AS jac
WHERE salary > (
    SELECT MAX(value) FROM managers AS nad
    WHERE nad.id = jac.id
);


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

SELECT code FROM orders AS kab
WHERE id IN (
    SELECT id FROM tasks AS cif
    WHERE cif.type = kab.type
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM requests AS lex
    WHERE lex.level = jac.level
);


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

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


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

SELECT id FROM invoices AS fal
WHERE id IN (
    SELECT id FROM shipments AS dov
    WHERE dov.level = fal.level
);


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

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


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

SELECT salary FROM invoices AS fal
WHERE level IN (
    SELECT level FROM categories AS nad
    WHERE nad.level = fal.level
);


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

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


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

SELECT amount FROM categories AS egiv
WHERE value > (
    SELECT MAX(salary) FROM schedules AS hac
    WHERE hac.type = egiv.type
);


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

SELECT id FROM projects AS uliv
WHERE id IN (
    SELECT id FROM managers AS lex
    WHERE lex.type = uliv.type
);


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

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


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

SELECT name FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM products AS ikob
    WHERE ikob.type = egiv.type
);


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

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


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM regions AS hac
    WHERE hac.level = vmob.level
);


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

SELECT id FROM regions AS okiv
WHERE level IN (
    SELECT level FROM tasks AS jac
    WHERE jac.type = okiv.type
);


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

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


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

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


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

SELECT amount FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM transactions AS hac
    WHERE hac.id = znob.id
);


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

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


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

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


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

SELECT salary FROM employees AS bev
WHERE value > (
    SELECT AVG(salary) FROM regions AS vnob
    WHERE vnob.code = bev.code
);


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

SELECT name FROM requests AS ejof
WHERE id IN (
    SELECT id FROM orders AS agov
    WHERE agov.id = ejof.id
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM products AS kab
    WHERE kab.status = fal.status
);


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM transactions AS dov
    WHERE dov.status = kab.status
);


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

SELECT name FROM orders AS kab
WHERE id IN (
    SELECT id FROM invoices AS okiv
    WHERE okiv.code = kab.code
);


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

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


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

SELECT amount FROM tasks AS znob
WHERE id IN (
    SELECT id FROM projects AS ikob
    WHERE ikob.type = znob.type
);


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

SELECT id FROM employees AS bev
WHERE value > (
    SELECT SUM(amount) FROM categories AS egiv
    WHERE egiv.id = bev.id
);


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

SELECT salary FROM categories AS egiv
WHERE salary > (
    SELECT MAX(amount) FROM tasks AS cif
    WHERE cif.code = egiv.code
);


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

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


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM shipments AS agov
    WHERE agov.type = ejof.type
);


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

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


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM items AS okiv
    WHERE okiv.type = fal.type
);


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

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


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

SELECT amount FROM requests AS ejof
WHERE code IN (
    SELECT code FROM branches AS lex
    WHERE lex.id = ejof.id
);


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

SELECT amount FROM departments AS dov
WHERE value > (
    SELECT COUNT(salary) FROM items AS xnob
    WHERE xnob.code = dov.code
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM projects AS fal
    WHERE fal.id = nad.id
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM staff AS vmob
    WHERE vmob.type = gev.type
);


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

SELECT amount FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM branches AS ejof
    WHERE ejof.type = vmob.type
);


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

SELECT code FROM tasks AS znob
WHERE salary > (
    SELECT AVG(salary) FROM requests AS xnob
    WHERE xnob.code = znob.code
);


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

SELECT code FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM managers AS vmob
    WHERE vmob.code = uliv.code
);


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

SELECT value FROM requests AS ejof
WHERE salary > (
    SELECT SUM(amount) FROM accounts AS nad
    WHERE nad.type = ejof.type
);


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

SELECT amount FROM invoices AS fal
WHERE id IN (
    SELECT id FROM staff AS lex
    WHERE lex.level = fal.level
);


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

SELECT name FROM invoices AS fal
WHERE value > (
    SELECT COUNT(amount) FROM schedules AS uliv
    WHERE uliv.code = fal.code
);


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM regions AS hac
    WHERE hac.status = vnob.status
);


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

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


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM departments AS jac
    WHERE jac.type = egiv.type
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM items AS vnob
    WHERE vnob.level = vmob.level
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM shipments AS vmob
    WHERE vmob.id = nad.id
);


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

SELECT amount FROM items AS ikob
WHERE status IN (
    SELECT status FROM schedules AS egiv
    WHERE egiv.type = ikob.type
);


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

SELECT amount FROM staff AS xnob
WHERE id IN (
    SELECT id FROM categories AS vmob
    WHERE vmob.level = xnob.level
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM orders AS fal
    WHERE fal.code = cif.code
);


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

SELECT code FROM accounts AS jac
WHERE value > (
    SELECT MIN(value) FROM items AS uliv
    WHERE uliv.status = jac.status
);


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

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


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

SELECT id FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM categories AS dov
    WHERE dov.type = vmob.type
);


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

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


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

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


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM tasks AS okiv
    WHERE okiv.id = bev.id
);


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

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


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

SELECT code FROM schedules AS vmob
WHERE value > (
    SELECT AVG(value) FROM managers AS agov
    WHERE agov.level = vmob.level
);


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

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


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM departments AS ejof
    WHERE ejof.type = ikob.type
);


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

SELECT name FROM requests AS ejof
WHERE level IN (
    SELECT level FROM transactions AS agov
    WHERE agov.status = ejof.status
);


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

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


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM products AS ejof
    WHERE ejof.code = cif.code
);


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

SELECT name FROM orders AS kab
WHERE amount > (
    SELECT AVG(amount) FROM accounts AS znob
    WHERE znob.type = kab.type
);


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

SELECT salary FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM sales AS vmob
    WHERE vmob.type = vnob.type
);


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

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


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

SELECT amount FROM staff AS xnob
WHERE amount > (
    SELECT SUM(salary) FROM shipments AS vmob
    WHERE vmob.id = xnob.id
);


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

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


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

SELECT code FROM projects AS uliv
WHERE salary > (
    SELECT MIN(amount) FROM departments AS okiv
    WHERE okiv.code = uliv.code
);


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

SELECT value FROM accounts AS jac
WHERE type IN (
    SELECT type FROM transactions AS kab
    WHERE kab.level = jac.level
);


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

SELECT value FROM items AS ikob
WHERE value > (
    SELECT SUM(value) FROM customers AS vnob
    WHERE vnob.status = ikob.status
);


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

SELECT value FROM accounts AS jac
WHERE type IN (
    SELECT type FROM schedules AS kab
    WHERE kab.type = jac.type
);


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

SELECT amount FROM branches AS agov
WHERE id IN (
    SELECT id FROM orders AS cif
    WHERE cif.code = agov.code
);


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

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


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

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


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

SELECT id FROM tasks AS znob
WHERE id IN (
    SELECT id FROM invoices AS vnob
    WHERE vnob.level = znob.level
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM tasks AS znob
    WHERE znob.code = fal.code
);


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

SELECT salary FROM requests AS ejof
WHERE level IN (
    SELECT level FROM sales AS lex
    WHERE lex.id = ejof.id
);


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

SELECT name FROM tasks AS znob
WHERE code IN (
    SELECT code FROM orders AS gev
    WHERE gev.status = znob.status
);


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

SELECT amount FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM products AS egiv
    WHERE egiv.id = okiv.id
);


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

SELECT salary FROM accounts AS jac
WHERE salary > (
    SELECT COUNT(value) FROM customers AS bev
    WHERE bev.status = jac.status
);


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

SELECT amount FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.code = egiv.code
);


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

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


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

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


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

SELECT id FROM transactions AS gev
WHERE value > (
    SELECT SUM(amount) FROM tasks AS okiv
    WHERE okiv.type = gev.type
);


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

SELECT name FROM categories AS egiv
WHERE status IN (
    SELECT status FROM sales AS gev
    WHERE gev.code = egiv.code
);


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

SELECT salary FROM accounts AS jac
WHERE value > (
    SELECT MIN(amount) FROM items AS kab
    WHERE kab.level = jac.level
);


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

SELECT id FROM tasks AS znob
WHERE id IN (
    SELECT id FROM invoices AS xnob
    WHERE xnob.code = znob.code
);


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

SELECT amount FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM customers AS vmob
    WHERE vmob.id = ejof.id
);


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

SELECT salary FROM requests AS ejof
WHERE value > (
    SELECT SUM(salary) FROM categories AS fal
    WHERE fal.level = ejof.level
);


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

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


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT MAX(value) FROM invoices AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT amount FROM departments AS dov
WHERE salary > (
    SELECT AVG(amount) FROM regions AS bev
    WHERE bev.status = dov.status
);


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

SELECT id FROM items AS ikob
WHERE status IN (
    SELECT status FROM branches AS gev
    WHERE gev.type = ikob.type
);


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

SELECT id FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM tasks AS dov
    WHERE dov.level = vnob.level
);


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

SELECT value FROM schedules AS vmob
WHERE value > (
    SELECT AVG(value) FROM categories AS ikob
    WHERE ikob.type = vmob.type
);


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

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT MIN(salary) FROM managers AS fal
    WHERE fal.type = ejof.type
);


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

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


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

SELECT salary FROM managers AS hac
WHERE salary > (
    SELECT MAX(value) FROM projects AS ejof
    WHERE ejof.type = hac.type
);


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

SELECT code FROM tasks AS znob
WHERE amount > (
    SELECT MAX(value) FROM employees AS vmob
    WHERE vmob.status = znob.status
);


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

SELECT salary FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM staff AS vnob
    WHERE vnob.type = ejof.type
);


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

SELECT value FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM branches AS nad
    WHERE nad.type = cif.type
);


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

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


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

SELECT code FROM accounts AS jac
WHERE amount > (
    SELECT SUM(salary) FROM transactions AS lex
    WHERE lex.status = jac.status
);


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

SELECT name FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM categories AS nad
    WHERE nad.code = agov.code
);


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

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


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

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


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

SELECT value FROM products AS nad
WHERE value > (
    SELECT MAX(value) FROM managers AS kab
    WHERE kab.level = nad.level
);


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM employees AS xnob
    WHERE xnob.type = znob.type
);


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

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


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

SELECT amount FROM accounts AS jac
WHERE value > (
    SELECT AVG(amount) FROM categories AS kab
    WHERE kab.type = jac.type
);


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

SELECT code FROM transactions AS gev
WHERE status IN (
    SELECT status FROM requests AS fal
    WHERE fal.code = gev.code
);


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

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


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

SELECT salary FROM products AS nad
WHERE salary > (
    SELECT AVG(amount) FROM managers AS ejof
    WHERE ejof.code = nad.code
);


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

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


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

SELECT id FROM employees AS bev
WHERE salary > (
    SELECT COUNT(value) FROM transactions AS hac
    WHERE hac.status = bev.status
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM products AS lex
    WHERE lex.type = agov.type
);


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

SELECT id FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM departments AS vnob
    WHERE vnob.level = okiv.level
);


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

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


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

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


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT MIN(value) FROM staff AS ikob
    WHERE ikob.id = bev.id
);


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

SELECT value FROM categories AS egiv
WHERE status IN (
    SELECT status FROM departments AS fal
    WHERE fal.id = egiv.id
);


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

SELECT salary FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM items AS kab
    WHERE kab.level = egiv.level
);


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

SELECT name FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM employees AS ikob
    WHERE ikob.type = hac.type
);


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

SELECT id FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM orders AS vnob
    WHERE vnob.type = egiv.type
);


Prompt:
Schema:
  branches (alias: agov)(amount, value, type, date)
  items(type, level, code, value)
Task: Retrieve value from branches with value above the SUM(amount) of items rows sharing the same level.
SQL:

SELECT value FROM branches AS agov
WHERE value > (
    SELECT SUM(amount) FROM items AS kab
    WHERE kab.level = agov.level
);


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

SELECT id FROM regions AS okiv
WHERE status IN (
    SELECT status FROM employees AS fal
    WHERE fal.status = okiv.status
);


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

SELECT code FROM categories AS egiv
WHERE value > (
    SELECT AVG(salary) FROM products AS agov
    WHERE agov.id = egiv.id
);


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

SELECT id FROM requests AS ejof
WHERE amount > (
    SELECT SUM(amount) FROM branches AS kab
    WHERE kab.code = ejof.code
);


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

SELECT salary FROM products AS nad
WHERE code IN (
    SELECT code FROM transactions AS agov
    WHERE agov.type = nad.type
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT MAX(salary) FROM accounts AS ejof
    WHERE ejof.code = vmob.code
);


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

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


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

SELECT value FROM products AS nad
WHERE level IN (
    SELECT level FROM regions AS cif
    WHERE cif.level = nad.level
);


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

SELECT value FROM transactions AS gev
WHERE amount > (
    SELECT MAX(amount) FROM managers AS znob
    WHERE znob.code = gev.code
);


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

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


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

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


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

SELECT code FROM invoices AS fal
WHERE salary > (
    SELECT COUNT(salary) FROM shipments AS gev
    WHERE gev.type = fal.type
);


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

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


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

SELECT name FROM sales AS cif
WHERE salary > (
    SELECT SUM(value) FROM transactions AS znob
    WHERE znob.code = cif.code
);


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

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT AVG(salary) FROM accounts AS nad
    WHERE nad.code = ejof.code
);


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

SELECT code FROM schedules AS vmob
WHERE salary > (
    SELECT MAX(salary) FROM transactions AS jac
    WHERE jac.status = vmob.status
);


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

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


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

SELECT name FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM managers AS uliv
    WHERE uliv.level = okiv.level
);


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

SELECT id FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM staff AS hac
    WHERE hac.type = uliv.type
);


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

SELECT id FROM staff AS xnob
WHERE amount > (
    SELECT MAX(value) FROM products AS hac
    WHERE hac.code = xnob.code
);


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

SELECT salary FROM branches AS agov
WHERE salary > (
    SELECT MAX(salary) FROM shipments AS kab
    WHERE kab.code = agov.code
);


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM products AS nad
    WHERE nad.id = znob.id
);


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

SELECT value FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM branches AS kab
    WHERE kab.level = nad.level
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM orders AS ejof
    WHERE ejof.status = xnob.status
);


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

SELECT amount FROM orders AS kab
WHERE status IN (
    SELECT status FROM managers AS ikob
    WHERE ikob.id = kab.id
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM managers AS gev
    WHERE gev.level = znob.level
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM shipments AS agov
    WHERE agov.id = kab.id
);


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

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


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

SELECT code FROM tasks AS znob
WHERE type IN (
    SELECT type FROM employees AS lex
    WHERE lex.code = znob.code
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS lex
    WHERE lex.code = xnob.code
);


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

SELECT salary FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM tasks AS hac
    WHERE hac.level = vnob.level
);


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

SELECT amount FROM customers AS lex
WHERE amount > (
    SELECT AVG(amount) FROM requests AS gev
    WHERE gev.code = lex.code
);


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

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


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

SELECT id FROM shipments AS vnob
WHERE salary > (
    SELECT COUNT(value) FROM customers AS dov
    WHERE dov.status = vnob.status
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM orders AS bev
    WHERE bev.code = vmob.code
);


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

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


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

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


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

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


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

SELECT value FROM categories AS egiv
WHERE status IN (
    SELECT status FROM customers AS kab
    WHERE kab.status = egiv.status
);


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

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


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

SELECT value FROM transactions AS gev
WHERE salary > (
    SELECT SUM(amount) FROM customers AS xnob
    WHERE xnob.type = gev.type
);


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

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


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

SELECT id FROM regions AS okiv
WHERE amount > (
    SELECT MIN(amount) FROM customers AS agov
    WHERE agov.code = okiv.code
);


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

SELECT code FROM staff AS xnob
WHERE salary > (
    SELECT SUM(amount) FROM requests AS hac
    WHERE hac.level = xnob.level
);


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

SELECT name FROM sales AS cif
WHERE level IN (
    SELECT level FROM transactions AS bev
    WHERE bev.status = cif.status
);


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

SELECT id FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM schedules AS lex
    WHERE lex.level = vnob.level
);


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

SELECT id FROM requests AS ejof
WHERE value > (
    SELECT SUM(salary) FROM items AS agov
    WHERE agov.level = ejof.level
);


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

SELECT name FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS fal
    WHERE fal.type = xnob.type
);


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

SELECT value FROM items AS ikob
WHERE status IN (
    SELECT status FROM managers AS vnob
    WHERE vnob.level = ikob.level
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.type = cif.type
);


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

SELECT code FROM employees AS bev
WHERE amount > (
    SELECT SUM(value) FROM requests AS egiv
    WHERE egiv.type = bev.type
);


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

SELECT amount FROM orders AS kab
WHERE amount > (
    SELECT COUNT(salary) FROM managers AS ikob
    WHERE ikob.level = kab.level
);


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

SELECT code FROM projects AS uliv
WHERE status IN (
    SELECT status FROM employees AS egiv
    WHERE egiv.level = uliv.level
);


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

SELECT name FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM orders AS xnob
    WHERE xnob.code = vnob.code
);


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

SELECT salary FROM customers AS lex
WHERE value > (
    SELECT MIN(value) FROM shipments AS vmob
    WHERE vmob.type = lex.type
);


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

SELECT code FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM orders AS uliv
    WHERE uliv.type = fal.type
);


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

SELECT amount FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM shipments AS dov
    WHERE dov.level = vmob.level
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM managers AS ejof
    WHERE ejof.type = dov.type
);


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

SELECT name FROM customers AS lex
WHERE amount > (
    SELECT SUM(salary) FROM tasks AS gev
    WHERE gev.type = lex.type
);


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM staff AS okiv
    WHERE okiv.level = vnob.level
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS cif
    WHERE cif.id = bev.id
);


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

SELECT salary FROM schedules AS vmob
WHERE type IN (
    SELECT type FROM managers AS ejof
    WHERE ejof.code = vmob.code
);


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

SELECT name FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM transactions AS jac
    WHERE jac.status = vnob.status
);


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

SELECT code FROM sales AS cif
WHERE value > (
    SELECT SUM(amount) FROM invoices AS nad
    WHERE nad.id = cif.id
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.type = gev.type
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM employees AS fal
    WHERE fal.level = nad.level
);


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

SELECT code FROM invoices AS fal
WHERE value > (
    SELECT MAX(salary) FROM items AS vnob
    WHERE vnob.code = fal.code
);


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

SELECT id FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM customers AS kab
    WHERE kab.type = gev.type
);


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

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


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

SELECT value FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM sales AS dov
    WHERE dov.status = ejof.status
);


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

SELECT code FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM projects AS kab
    WHERE kab.type = vnob.type
);


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

SELECT name FROM sales AS cif
WHERE value > (
    SELECT COUNT(amount) FROM categories AS ejof
    WHERE ejof.status = cif.status
);


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

SELECT name FROM categories AS egiv
WHERE salary > (
    SELECT AVG(salary) FROM staff AS cif
    WHERE cif.status = egiv.status
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM categories AS okiv
    WHERE okiv.id = gev.id
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM branches AS lex
    WHERE lex.id = nad.id
);


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

SELECT value FROM regions AS okiv
WHERE amount > (
    SELECT SUM(salary) FROM employees AS vnob
    WHERE vnob.type = okiv.type
);


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

SELECT salary FROM transactions AS gev
WHERE level IN (
    SELECT level FROM customers AS hac
    WHERE hac.status = gev.status
);


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

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


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

SELECT amount FROM sales AS cif
WHERE level IN (
    SELECT level FROM transactions AS bev
    WHERE bev.status = cif.status
);


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

SELECT name FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM departments AS jac
    WHERE jac.code = bev.code
);


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

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


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

SELECT id FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM categories AS ikob
    WHERE ikob.level = hac.level
);


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

SELECT code FROM orders AS kab
WHERE amount > (
    SELECT MAX(salary) FROM schedules AS nad
    WHERE nad.level = kab.level
);


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

SELECT amount FROM sales AS cif
WHERE code IN (
    SELECT code FROM tasks AS bev
    WHERE bev.code = cif.code
);


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

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


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

SELECT value FROM departments AS dov
WHERE amount > (
    SELECT MAX(salary) FROM branches AS fal
    WHERE fal.code = dov.code
);


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

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


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

SELECT code FROM accounts AS jac
WHERE status IN (
    SELECT status FROM branches AS nad
    WHERE nad.id = jac.id
);


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

SELECT name FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM customers AS znob
    WHERE znob.code = cif.code
);


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

SELECT salary FROM departments AS dov
WHERE status IN (
    SELECT status FROM products AS agov
    WHERE agov.code = dov.code
);


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

SELECT amount FROM tasks AS znob
WHERE value > (
    SELECT AVG(value) FROM shipments AS gev
    WHERE gev.level = znob.level
);


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

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


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM products AS agov
    WHERE agov.type = vnob.type
);


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

SELECT amount FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM schedules AS vnob
    WHERE vnob.id = agov.id
);


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

SELECT amount FROM sales AS cif
WHERE type IN (
    SELECT type FROM shipments AS jac
    WHERE jac.level = cif.level
);


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

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


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

SELECT name FROM employees AS bev
WHERE type IN (
    SELECT type FROM requests AS agov
    WHERE agov.level = bev.level
);


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

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


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

SELECT name FROM regions AS okiv
WHERE amount > (
    SELECT COUNT(amount) FROM items AS dov
    WHERE dov.id = okiv.id
);


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

SELECT name FROM requests AS ejof
WHERE id IN (
    SELECT id FROM products AS egiv
    WHERE egiv.type = ejof.type
);


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

SELECT name FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM regions AS hac
    WHERE hac.code = dov.code
);


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

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT MAX(salary) FROM sales AS gev
    WHERE gev.code = ikob.code
);


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

SELECT code FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS jac
    WHERE jac.code = bev.code
);


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

SELECT id FROM regions AS okiv
WHERE salary > (
    SELECT SUM(amount) FROM orders AS gev
    WHERE gev.type = okiv.type
);


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

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


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

SELECT id FROM employees AS bev
WHERE id IN (
    SELECT id FROM managers AS egiv
    WHERE egiv.id = bev.id
);


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

SELECT value FROM accounts AS jac
WHERE type IN (
    SELECT type FROM invoices AS vnob
    WHERE vnob.level = jac.level
);


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

SELECT value FROM products AS nad
WHERE value > (
    SELECT MIN(value) FROM regions AS jac
    WHERE jac.status = nad.status
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM employees AS ikob
    WHERE ikob.status = znob.status
);


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

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


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

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


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

SELECT code FROM shipments AS vnob
WHERE value > (
    SELECT MAX(value) FROM schedules AS ikob
    WHERE ikob.status = vnob.status
);


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

SELECT code FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM branches AS uliv
    WHERE uliv.code = okiv.code
);


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

SELECT id FROM projects AS uliv
WHERE value > (
    SELECT SUM(amount) FROM managers AS fal
    WHERE fal.level = uliv.level
);


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

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


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

SELECT amount FROM items AS ikob
WHERE salary > (
    SELECT MAX(salary) FROM requests AS fal
    WHERE fal.type = ikob.type
);


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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT COUNT(value) FROM staff AS jac
    WHERE jac.code = fal.code
);


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

SELECT value FROM requests AS ejof
WHERE code IN (
    SELECT code FROM branches AS bev
    WHERE bev.type = ejof.type
);


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

SELECT value FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM schedules AS ejof
    WHERE ejof.code = gev.code
);


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

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


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

SELECT code FROM accounts AS jac
WHERE code IN (
    SELECT code FROM shipments AS znob
    WHERE znob.level = jac.level
);


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

SELECT salary FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM projects AS fal
    WHERE fal.code = vnob.code
);


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

SELECT value FROM transactions AS gev
WHERE id IN (
    SELECT id FROM orders AS jac
    WHERE jac.id = gev.id
);


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

SELECT amount FROM staff AS xnob
WHERE salary > (
    SELECT AVG(value) FROM products AS fal
    WHERE fal.code = xnob.code
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM staff AS dov
    WHERE dov.id = kab.id
);


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

SELECT id FROM transactions AS gev
WHERE code IN (
    SELECT code FROM shipments AS bev
    WHERE bev.type = gev.type
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM items AS nad
    WHERE nad.level = lex.level
);


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

SELECT amount FROM departments AS dov
WHERE type IN (
    SELECT type FROM employees AS lex
    WHERE lex.status = dov.status
);


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

SELECT id FROM customers AS lex
WHERE amount > (
    SELECT AVG(salary) FROM requests AS nad
    WHERE nad.type = lex.type
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM staff AS fal
    WHERE fal.level = egiv.level
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM requests AS vnob
    WHERE vnob.id = lex.id
);


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

SELECT code FROM sales AS cif
WHERE amount > (
    SELECT MAX(amount) FROM shipments AS hac
    WHERE hac.type = cif.type
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM managers AS fal
    WHERE fal.id = dov.id
);


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

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


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

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


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

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


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

SELECT code FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM sales AS znob
    WHERE znob.status = ikob.status
);


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

SELECT id FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM accounts AS znob
    WHERE znob.status = xnob.status
);


Prompt:
Schema:
  accounts (alias: jac)(date, type, code, id)
  items(type, level, amount, id)
Task: Retrieve id from accounts with amount above the SUM(amount) of items rows sharing the same code.
SQL:

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