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

SELECT name FROM regions AS okiv
WHERE level IN (
    SELECT level FROM projects AS znob
    WHERE znob.type = okiv.type
);


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

SELECT code FROM requests AS ejof
WHERE type IN (
    SELECT type FROM employees AS agov
    WHERE agov.id = ejof.id
);


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

SELECT name FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM managers AS agov
    WHERE agov.id = kab.id
);


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

SELECT name FROM employees AS bev
WHERE value > (
    SELECT COUNT(value) FROM departments AS agov
    WHERE agov.id = bev.id
);


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

SELECT code FROM sales AS cif
WHERE level IN (
    SELECT level FROM requests AS egiv
    WHERE egiv.level = cif.level
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT COUNT(amount) FROM sales AS ejof
    WHERE ejof.code = okiv.code
);


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

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


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

SELECT id FROM transactions AS gev
WHERE status IN (
    SELECT status FROM departments AS vnob
    WHERE vnob.type = gev.type
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM sales AS kab
    WHERE kab.id = lex.id
);


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

SELECT id FROM sales AS cif
WHERE type IN (
    SELECT type FROM accounts AS jac
    WHERE jac.status = cif.status
);


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

SELECT name FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM requests AS bev
    WHERE bev.code = gev.code
);


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

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


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

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


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

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


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

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


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM items AS cif
    WHERE cif.status = xnob.status
);


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

SELECT code FROM staff AS xnob
WHERE value > (
    SELECT AVG(value) FROM shipments AS agov
    WHERE agov.type = xnob.type
);


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

SELECT code FROM categories AS egiv
WHERE EXISTS (
    SELECT 1 FROM customers AS vmob
    WHERE vmob.level = egiv.level
);


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

SELECT amount FROM staff AS xnob
WHERE level IN (
    SELECT level FROM schedules AS jac
    WHERE jac.level = xnob.level
);


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

SELECT value FROM requests AS ejof
WHERE status IN (
    SELECT status FROM tasks AS hac
    WHERE hac.code = ejof.code
);


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

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


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

SELECT code FROM accounts AS jac
WHERE level IN (
    SELECT level FROM categories AS gev
    WHERE gev.code = jac.code
);


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

SELECT value FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM managers AS xnob
    WHERE xnob.type = jac.type
);


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

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


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

SELECT amount FROM departments AS dov
WHERE status IN (
    SELECT status FROM products AS vmob
    WHERE vmob.level = dov.level
);


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

SELECT code FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM sales AS gev
    WHERE gev.id = agov.id
);


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

SELECT value FROM transactions AS gev
WHERE salary > (
    SELECT COUNT(amount) FROM projects AS vnob
    WHERE vnob.id = gev.id
);


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

SELECT id FROM managers AS hac
WHERE status IN (
    SELECT status FROM regions AS agov
    WHERE agov.id = hac.id
);


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

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


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

SELECT name FROM tasks AS znob
WHERE type IN (
    SELECT type FROM requests AS egiv
    WHERE egiv.type = znob.type
);


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT MAX(amount) FROM requests AS bev
    WHERE bev.type = agov.type
);


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

SELECT name FROM shipments AS vnob
WHERE value > (
    SELECT SUM(value) FROM items AS ejof
    WHERE ejof.status = vnob.status
);


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

SELECT salary FROM sales AS cif
WHERE value > (
    SELECT MIN(value) FROM tasks AS ikob
    WHERE ikob.code = cif.code
);


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

SELECT value FROM sales AS cif
WHERE code IN (
    SELECT code FROM projects AS znob
    WHERE znob.id = cif.id
);


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

SELECT salary FROM staff AS xnob
WHERE value > (
    SELECT MAX(amount) FROM categories AS kab
    WHERE kab.code = xnob.code
);


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

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


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

SELECT amount FROM transactions AS gev
WHERE value > (
    SELECT SUM(amount) FROM orders AS bev
    WHERE bev.code = gev.code
);


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

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


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

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


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

SELECT amount FROM branches AS agov
WHERE amount > (
    SELECT AVG(amount) FROM customers AS znob
    WHERE znob.status = agov.status
);


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

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


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

SELECT amount FROM departments AS dov
WHERE status IN (
    SELECT status FROM orders AS egiv
    WHERE egiv.id = dov.id
);


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

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


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

SELECT salary FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS ejof
    WHERE ejof.code = vnob.code
);


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

SELECT amount FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM customers AS vmob
    WHERE vmob.id = znob.id
);


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

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


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

SELECT name FROM regions AS okiv
WHERE type IN (
    SELECT type FROM accounts AS vnob
    WHERE vnob.code = okiv.code
);


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

SELECT name FROM managers AS hac
WHERE type IN (
    SELECT type FROM categories AS kab
    WHERE kab.level = hac.level
);


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

SELECT value FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM products AS uliv
    WHERE uliv.code = dov.code
);


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

SELECT amount FROM tasks AS znob
WHERE status IN (
    SELECT status FROM invoices AS cif
    WHERE cif.id = znob.id
);


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

SELECT code FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM orders AS nad
    WHERE nad.id = gev.id
);


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

SELECT amount FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM departments AS vnob
    WHERE vnob.level = bev.level
);


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

SELECT amount FROM categories AS egiv
WHERE code IN (
    SELECT code FROM departments AS lex
    WHERE lex.level = egiv.level
);


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

SELECT name FROM categories AS egiv
WHERE status IN (
    SELECT status FROM branches AS hac
    WHERE hac.status = egiv.status
);


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

SELECT name FROM employees AS bev
WHERE salary > (
    SELECT COUNT(amount) FROM accounts AS agov
    WHERE agov.code = bev.code
);


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

SELECT code FROM tasks AS znob
WHERE salary > (
    SELECT SUM(salary) FROM products AS bev
    WHERE bev.level = znob.level
);


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

SELECT amount FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM projects AS znob
    WHERE znob.status = nad.status
);


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

SELECT name FROM employees AS bev
WHERE amount > (
    SELECT SUM(amount) FROM items AS lex
    WHERE lex.id = bev.id
);


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

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


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM orders AS lex
    WHERE lex.code = vnob.code
);


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

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


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

SELECT salary FROM requests AS ejof
WHERE type IN (
    SELECT type FROM transactions AS fal
    WHERE fal.type = ejof.type
);


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

SELECT name FROM staff AS xnob
WHERE amount > (
    SELECT COUNT(salary) FROM regions AS fal
    WHERE fal.id = xnob.id
);


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

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


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

SELECT value FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM accounts AS cif
    WHERE cif.code = ikob.code
);


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

SELECT salary FROM items AS ikob
WHERE level IN (
    SELECT level FROM transactions AS vmob
    WHERE vmob.status = ikob.status
);


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

SELECT value FROM schedules AS vmob
WHERE salary > (
    SELECT SUM(value) FROM requests AS okiv
    WHERE okiv.status = vmob.status
);


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

SELECT amount FROM departments AS dov
WHERE level IN (
    SELECT level FROM items AS vmob
    WHERE vmob.status = dov.status
);


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

SELECT name FROM projects AS uliv
WHERE amount > (
    SELECT AVG(value) FROM categories AS kab
    WHERE kab.code = uliv.code
);


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

SELECT name FROM departments AS dov
WHERE type IN (
    SELECT type FROM employees AS znob
    WHERE znob.level = dov.level
);


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

SELECT id FROM customers AS lex
WHERE status IN (
    SELECT status FROM sales AS jac
    WHERE jac.status = lex.status
);


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

SELECT code FROM branches AS agov
WHERE salary > (
    SELECT MIN(value) FROM products AS gev
    WHERE gev.type = agov.type
);


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

SELECT code FROM customers AS lex
WHERE status IN (
    SELECT status FROM shipments AS bev
    WHERE bev.type = lex.type
);


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

SELECT salary FROM products AS nad
WHERE type IN (
    SELECT type FROM branches AS lex
    WHERE lex.type = nad.type
);


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

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


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

SELECT code FROM employees AS bev
WHERE type IN (
    SELECT type FROM requests AS kab
    WHERE kab.code = bev.code
);


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

SELECT id FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM projects AS fal
    WHERE fal.type = cif.type
);


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

SELECT amount FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM categories AS jac
    WHERE jac.type = vnob.type
);


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

SELECT name FROM customers AS lex
WHERE status IN (
    SELECT status FROM departments AS jac
    WHERE jac.code = lex.code
);


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

SELECT salary FROM invoices AS fal
WHERE value > (
    SELECT MIN(amount) FROM transactions AS kab
    WHERE kab.level = fal.level
);


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

SELECT salary FROM items AS ikob
WHERE status IN (
    SELECT status FROM requests AS dov
    WHERE dov.status = ikob.status
);


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

SELECT name FROM products AS nad
WHERE salary > (
    SELECT SUM(salary) FROM sales AS lex
    WHERE lex.type = nad.type
);


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

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


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

SELECT amount FROM invoices AS fal
WHERE status IN (
    SELECT status FROM transactions AS uliv
    WHERE uliv.level = fal.level
);


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

SELECT name FROM accounts AS jac
WHERE salary > (
    SELECT COUNT(value) FROM categories AS okiv
    WHERE okiv.id = jac.id
);


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

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


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

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


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

SELECT amount FROM regions AS okiv
WHERE salary > (
    SELECT SUM(salary) FROM invoices AS hac
    WHERE hac.level = okiv.level
);


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

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


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

SELECT name FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM categories AS nad
    WHERE nad.id = vmob.id
);


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

SELECT code FROM items AS ikob
WHERE salary > (
    SELECT MIN(salary) FROM employees AS znob
    WHERE znob.id = ikob.id
);


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

SELECT salary FROM staff AS xnob
WHERE id IN (
    SELECT id FROM customers AS vmob
    WHERE vmob.code = xnob.code
);


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

SELECT value FROM staff AS xnob
WHERE status IN (
    SELECT status FROM schedules AS nad
    WHERE nad.status = xnob.status
);


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

SELECT id FROM accounts AS jac
WHERE value > (
    SELECT MAX(amount) FROM requests AS vnob
    WHERE vnob.type = jac.type
);


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

SELECT code FROM schedules AS vmob
WHERE id IN (
    SELECT id FROM departments AS agov
    WHERE agov.code = vmob.code
);


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM staff AS okiv
    WHERE okiv.type = nad.type
);


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

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


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

SELECT salary FROM regions AS okiv
WHERE type IN (
    SELECT type FROM shipments AS egiv
    WHERE egiv.id = okiv.id
);


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

SELECT salary FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM managers AS kab
    WHERE kab.id = nad.id
);


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

SELECT code FROM categories AS egiv
WHERE salary > (
    SELECT SUM(salary) FROM managers AS okiv
    WHERE okiv.id = egiv.id
);


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

SELECT salary FROM transactions AS gev
WHERE code IN (
    SELECT code FROM regions AS znob
    WHERE znob.type = gev.type
);


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

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


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

SELECT id FROM customers AS lex
WHERE type IN (
    SELECT type FROM requests AS agov
    WHERE agov.type = lex.type
);


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

SELECT salary FROM departments AS dov
WHERE value > (
    SELECT MAX(value) FROM schedules AS nad
    WHERE nad.code = dov.code
);


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

SELECT name FROM orders AS kab
WHERE salary > (
    SELECT MAX(value) FROM projects AS gev
    WHERE gev.status = kab.status
);


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

SELECT code FROM orders AS kab
WHERE status IN (
    SELECT status FROM managers AS ejof
    WHERE ejof.type = kab.type
);


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

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


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

SELECT id FROM projects AS uliv
WHERE salary > (
    SELECT SUM(salary) FROM staff AS okiv
    WHERE okiv.type = uliv.type
);


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

SELECT name FROM orders AS kab
WHERE salary > (
    SELECT MAX(value) FROM products AS okiv
    WHERE okiv.status = kab.status
);


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

SELECT id FROM requests AS ejof
WHERE salary > (
    SELECT AVG(value) FROM categories AS hac
    WHERE hac.status = ejof.status
);


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

SELECT id FROM items AS ikob
WHERE salary > (
    SELECT AVG(salary) FROM schedules AS kab
    WHERE kab.id = ikob.id
);


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

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


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

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


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

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


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

SELECT value FROM sales AS cif
WHERE status IN (
    SELECT status FROM branches AS jac
    WHERE jac.status = cif.status
);


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM shipments AS okiv
    WHERE okiv.level = agov.level
);


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

SELECT salary FROM managers AS hac
WHERE amount > (
    SELECT SUM(salary) FROM employees AS fal
    WHERE fal.id = hac.id
);


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

SELECT amount FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM shipments AS egiv
    WHERE egiv.type = kab.type
);


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

SELECT value FROM products AS nad
WHERE status IN (
    SELECT status FROM projects AS dov
    WHERE dov.id = nad.id
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM shipments AS ejof
    WHERE ejof.level = nad.level
);


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

SELECT name FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM orders AS fal
    WHERE fal.code = ejof.code
);


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

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


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

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


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

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


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

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


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

SELECT name FROM schedules AS vmob
WHERE code IN (
    SELECT code FROM customers AS uliv
    WHERE uliv.status = vmob.status
);


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

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


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

SELECT salary FROM employees AS bev
WHERE code IN (
    SELECT code FROM sales AS uliv
    WHERE uliv.code = bev.code
);


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

SELECT amount FROM branches AS agov
WHERE amount > (
    SELECT AVG(salary) FROM staff AS dov
    WHERE dov.code = agov.code
);


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

SELECT id FROM staff AS xnob
WHERE amount > (
    SELECT SUM(value) FROM schedules AS gev
    WHERE gev.id = xnob.id
);


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

SELECT salary FROM orders AS kab
WHERE value > (
    SELECT COUNT(salary) FROM sales AS xnob
    WHERE xnob.status = kab.status
);


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

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


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

SELECT id FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM regions AS ikob
    WHERE ikob.type = ejof.type
);


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

SELECT code FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(amount) FROM transactions AS nad
    WHERE nad.level = ejof.level
);


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

SELECT code FROM items AS ikob
WHERE amount > (
    SELECT SUM(value) FROM tasks AS znob
    WHERE znob.type = ikob.type
);


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

SELECT salary FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM employees AS lex
    WHERE lex.id = kab.id
);


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

SELECT amount FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM projects AS bev
    WHERE bev.status = lex.status
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT SUM(value) FROM branches AS bev
    WHERE bev.id = okiv.id
);


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

SELECT salary FROM shipments AS vnob
WHERE amount > (
    SELECT COUNT(salary) FROM customers AS ikob
    WHERE ikob.type = vnob.type
);


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

SELECT amount FROM shipments AS vnob
WHERE id IN (
    SELECT id FROM tasks AS okiv
    WHERE okiv.level = vnob.level
);


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

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


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

SELECT amount FROM sales AS cif
WHERE status IN (
    SELECT status FROM products AS egiv
    WHERE egiv.code = cif.code
);


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

SELECT name FROM accounts AS jac
WHERE value > (
    SELECT MAX(amount) FROM departments AS bev
    WHERE bev.id = jac.id
);


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

SELECT name FROM departments AS dov
WHERE amount > (
    SELECT COUNT(salary) FROM shipments AS xnob
    WHERE xnob.level = dov.level
);


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

SELECT code FROM categories AS egiv
WHERE type IN (
    SELECT type FROM orders AS uliv
    WHERE uliv.status = egiv.status
);


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

SELECT value FROM customers AS lex
WHERE code IN (
    SELECT code FROM shipments AS znob
    WHERE znob.status = lex.status
);


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

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


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

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


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

SELECT value FROM customers AS lex
WHERE value > (
    SELECT MAX(amount) FROM shipments AS kab
    WHERE kab.level = lex.level
);


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

SELECT value FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM accounts AS okiv
    WHERE okiv.level = hac.level
);


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

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


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

SELECT salary FROM managers AS hac
WHERE value > (
    SELECT COUNT(amount) FROM requests AS jac
    WHERE jac.type = hac.type
);


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

SELECT id FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM tasks AS hac
    WHERE hac.status = vmob.status
);


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

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


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

SELECT id FROM transactions AS gev
WHERE type IN (
    SELECT type FROM staff AS hac
    WHERE hac.status = gev.status
);


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

SELECT id FROM categories AS egiv
WHERE status IN (
    SELECT status FROM projects AS vnob
    WHERE vnob.level = egiv.level
);


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

SELECT code FROM departments AS dov
WHERE status IN (
    SELECT status FROM accounts AS ikob
    WHERE ikob.code = dov.code
);


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

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


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

SELECT code FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM schedules AS znob
    WHERE znob.type = nad.type
);


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

SELECT name FROM products AS nad
WHERE EXISTS (
    SELECT 1 FROM transactions AS bev
    WHERE bev.level = nad.level
);


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

SELECT amount FROM shipments AS vnob
WHERE EXISTS (
    SELECT 1 FROM tasks AS kab
    WHERE kab.id = vnob.id
);


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

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


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

SELECT salary FROM tasks AS znob
WHERE status IN (
    SELECT status FROM employees AS lex
    WHERE lex.level = znob.level
);


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

SELECT code FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM tasks AS xnob
    WHERE xnob.code = okiv.code
);


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

SELECT salary FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM staff AS jac
    WHERE jac.code = vmob.code
);


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

SELECT name FROM shipments AS vnob
WHERE value > (
    SELECT MAX(salary) FROM customers AS bev
    WHERE bev.id = vnob.id
);


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

SELECT name FROM requests AS ejof
WHERE value > (
    SELECT SUM(amount) FROM schedules AS okiv
    WHERE okiv.code = ejof.code
);


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

SELECT name FROM items AS ikob
WHERE EXISTS (
    SELECT 1 FROM managers AS gev
    WHERE gev.code = ikob.code
);


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

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


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

SELECT code FROM branches AS agov
WHERE code IN (
    SELECT code FROM projects AS vmob
    WHERE vmob.id = agov.id
);


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

SELECT name FROM shipments AS vnob
WHERE level IN (
    SELECT level FROM transactions AS ejof
    WHERE ejof.status = vnob.status
);


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

SELECT code FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM managers AS cif
    WHERE cif.status = xnob.status
);


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

SELECT code FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM managers AS lex
    WHERE lex.id = znob.id
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM projects AS dov
    WHERE dov.status = agov.status
);


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

SELECT amount FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM products AS vmob
    WHERE vmob.level = fal.level
);


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

SELECT value FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM departments AS kab
    WHERE kab.code = uliv.code
);


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

SELECT salary FROM tasks AS znob
WHERE EXISTS (
    SELECT 1 FROM requests AS cif
    WHERE cif.status = znob.status
);


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

SELECT name FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM managers AS kab
    WHERE kab.type = lex.type
);


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

SELECT name FROM schedules AS vmob
WHERE amount > (
    SELECT AVG(salary) FROM products AS ikob
    WHERE ikob.status = vmob.status
);


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

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


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

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


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

SELECT code FROM shipments AS vnob
WHERE value > (
    SELECT SUM(salary) FROM items AS jac
    WHERE jac.status = vnob.status
);


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

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


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

SELECT id FROM requests AS ejof
WHERE value > (
    SELECT MAX(value) FROM categories AS egiv
    WHERE egiv.id = ejof.id
);


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

SELECT name FROM managers AS hac
WHERE amount > (
    SELECT SUM(value) FROM schedules AS vnob
    WHERE vnob.level = hac.level
);


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

SELECT code FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM projects AS dov
    WHERE dov.code = agov.code
);


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

SELECT value FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM schedules AS fal
    WHERE fal.id = agov.id
);


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

SELECT name FROM branches AS agov
WHERE salary > (
    SELECT AVG(salary) FROM categories AS ejof
    WHERE ejof.code = agov.code
);


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

SELECT amount FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM schedules AS agov
    WHERE agov.id = gev.id
);


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

SELECT value FROM customers AS lex
WHERE salary > (
    SELECT AVG(salary) FROM projects AS kab
    WHERE kab.status = lex.status
);


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

SELECT salary FROM requests AS ejof
WHERE code IN (
    SELECT code FROM branches AS bev
    WHERE bev.status = ejof.status
);


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

SELECT value FROM managers AS hac
WHERE id IN (
    SELECT id FROM departments AS cif
    WHERE cif.level = hac.level
);


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

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


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

SELECT amount FROM accounts AS jac
WHERE status IN (
    SELECT status FROM orders AS vnob
    WHERE vnob.code = jac.code
);


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

SELECT name FROM employees AS bev
WHERE status IN (
    SELECT status FROM regions AS kab
    WHERE kab.type = bev.type
);


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

SELECT name FROM projects AS uliv
WHERE EXISTS (
    SELECT 1 FROM accounts AS gev
    WHERE gev.id = uliv.id
);


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

SELECT name FROM regions AS okiv
WHERE value > (
    SELECT COUNT(value) FROM managers AS dov
    WHERE dov.level = okiv.level
);


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

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


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

SELECT name FROM customers AS lex
WHERE type IN (
    SELECT type FROM shipments AS jac
    WHERE jac.type = lex.type
);


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

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


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

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


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

SELECT name FROM products AS nad
WHERE code IN (
    SELECT code FROM orders AS znob
    WHERE znob.status = nad.status
);


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

SELECT id FROM requests AS ejof
WHERE type IN (
    SELECT type FROM employees AS cif
    WHERE cif.level = ejof.level
);


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

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


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

SELECT name FROM categories AS egiv
WHERE level IN (
    SELECT level FROM shipments AS fal
    WHERE fal.id = egiv.id
);


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

SELECT value FROM managers AS hac
WHERE type IN (
    SELECT type FROM employees AS egiv
    WHERE egiv.level = hac.level
);


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

SELECT code FROM branches AS agov
WHERE code IN (
    SELECT code FROM accounts AS xnob
    WHERE xnob.code = agov.code
);


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

SELECT id FROM sales AS cif
WHERE salary > (
    SELECT SUM(salary) FROM shipments AS uliv
    WHERE uliv.code = cif.code
);


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

SELECT name FROM staff AS xnob
WHERE type IN (
    SELECT type FROM projects AS okiv
    WHERE okiv.id = xnob.id
);


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

SELECT value FROM products AS nad
WHERE salary > (
    SELECT SUM(amount) FROM accounts AS egiv
    WHERE egiv.code = nad.code
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM invoices AS vmob
    WHERE vmob.type = xnob.type
);


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

SELECT salary FROM accounts AS jac
WHERE code IN (
    SELECT code FROM requests AS fal
    WHERE fal.id = jac.id
);


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

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


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

SELECT code FROM invoices AS fal
WHERE salary > (
    SELECT MAX(amount) FROM items AS agov
    WHERE agov.type = fal.type
);


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

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


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

SELECT id FROM invoices AS fal
WHERE id IN (
    SELECT id FROM categories AS egiv
    WHERE egiv.id = fal.id
);


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

SELECT code FROM products AS nad
WHERE salary > (
    SELECT SUM(amount) FROM accounts AS xnob
    WHERE xnob.status = nad.status
);


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM managers AS egiv
    WHERE egiv.type = bev.type
);


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

SELECT id FROM items AS ikob
WHERE value > (
    SELECT MAX(amount) FROM employees AS lex
    WHERE lex.type = ikob.type
);


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

SELECT code FROM tasks AS znob
WHERE id IN (
    SELECT id FROM shipments AS ejof
    WHERE ejof.type = znob.type
);


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

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


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

SELECT id FROM requests AS ejof
WHERE amount > (
    SELECT COUNT(amount) FROM orders AS cif
    WHERE cif.level = ejof.level
);


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

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


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

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


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

SELECT value FROM sales AS cif
WHERE code IN (
    SELECT code FROM managers AS dov
    WHERE dov.code = cif.code
);


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

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


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

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


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

SELECT id FROM orders AS kab
WHERE status IN (
    SELECT status FROM customers AS uliv
    WHERE uliv.level = kab.level
);


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

SELECT salary FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM employees AS bev
    WHERE bev.type = xnob.type
);


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

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


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

SELECT amount FROM employees AS bev
WHERE salary > (
    SELECT AVG(amount) FROM transactions AS znob
    WHERE znob.id = bev.id
);


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

SELECT amount FROM items AS ikob
WHERE amount > (
    SELECT MIN(salary) FROM projects AS dov
    WHERE dov.code = ikob.code
);


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

SELECT amount FROM managers AS hac
WHERE EXISTS (
    SELECT 1 FROM schedules AS ikob
    WHERE ikob.level = hac.level
);


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

SELECT salary FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM transactions AS vmob
    WHERE vmob.id = agov.id
);


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

SELECT code FROM managers AS hac
WHERE salary > (
    SELECT SUM(salary) FROM products AS vmob
    WHERE vmob.code = hac.code
);


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

SELECT salary FROM sales AS cif
WHERE type IN (
    SELECT type FROM orders AS vmob
    WHERE vmob.type = cif.type
);


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

SELECT amount FROM categories AS egiv
WHERE id IN (
    SELECT id FROM items AS kab
    WHERE kab.id = egiv.id
);


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

SELECT value FROM products AS nad
WHERE code IN (
    SELECT code FROM shipments AS ikob
    WHERE ikob.type = nad.type
);


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

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


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

SELECT name FROM customers AS lex
WHERE id IN (
    SELECT id FROM items AS hac
    WHERE hac.id = lex.id
);


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

SELECT code FROM accounts AS jac
WHERE salary > (
    SELECT AVG(amount) FROM departments AS egiv
    WHERE egiv.type = jac.type
);


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

SELECT salary FROM requests AS ejof
WHERE status IN (
    SELECT status FROM departments AS fal
    WHERE fal.type = ejof.type
);


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

SELECT salary FROM sales AS cif
WHERE EXISTS (
    SELECT 1 FROM products AS vmob
    WHERE vmob.level = cif.level
);


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

SELECT code FROM categories AS egiv
WHERE value > (
    SELECT AVG(salary) FROM sales AS lex
    WHERE lex.level = egiv.level
);


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

SELECT code FROM products AS nad
WHERE salary > (
    SELECT AVG(value) FROM projects AS gev
    WHERE gev.type = nad.type
);


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

SELECT salary FROM shipments AS vnob
WHERE amount > (
    SELECT MAX(salary) FROM requests AS hac
    WHERE hac.type = vnob.type
);


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

SELECT amount FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM shipments AS xnob
    WHERE xnob.type = jac.type
);


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

SELECT amount FROM projects AS uliv
WHERE type IN (
    SELECT type FROM managers AS fal
    WHERE fal.code = uliv.code
);


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

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


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

SELECT salary FROM transactions AS gev
WHERE EXISTS (
    SELECT 1 FROM regions AS nad
    WHERE nad.level = gev.level
);


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

SELECT id FROM accounts AS jac
WHERE status IN (
    SELECT status FROM shipments AS xnob
    WHERE xnob.type = jac.type
);


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

SELECT code FROM orders AS kab
WHERE value > (
    SELECT COUNT(amount) FROM projects AS ejof
    WHERE ejof.id = kab.id
);


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

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


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

SELECT value FROM projects AS uliv
WHERE code IN (
    SELECT code FROM tasks AS bev
    WHERE bev.type = uliv.type
);


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

SELECT code FROM departments AS dov
WHERE type IN (
    SELECT type FROM branches AS cif
    WHERE cif.level = dov.level
);


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

SELECT code FROM schedules AS vmob
WHERE amount > (
    SELECT MAX(salary) FROM tasks AS lex
    WHERE lex.level = vmob.level
);


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

SELECT code FROM sales AS cif
WHERE value > (
    SELECT AVG(amount) FROM products AS ejof
    WHERE ejof.type = cif.type
);


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

SELECT code FROM customers AS lex
WHERE EXISTS (
    SELECT 1 FROM tasks AS jac
    WHERE jac.id = lex.id
);


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

SELECT code FROM invoices AS fal
WHERE amount > (
    SELECT AVG(amount) FROM requests AS nad
    WHERE nad.level = fal.level
);


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

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


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

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


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

SELECT amount FROM branches AS agov
WHERE salary > (
    SELECT MAX(salary) FROM regions AS hac
    WHERE hac.code = agov.code
);


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

SELECT salary FROM transactions AS gev
WHERE salary > (
    SELECT MIN(value) FROM requests AS xnob
    WHERE xnob.level = gev.level
);


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

SELECT salary FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM orders AS bev
    WHERE bev.type = fal.type
);


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

SELECT code FROM requests AS ejof
WHERE amount > (
    SELECT MIN(salary) FROM tasks AS gev
    WHERE gev.status = ejof.status
);


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

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


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

SELECT name FROM managers AS hac
WHERE code IN (
    SELECT code FROM orders AS ejof
    WHERE ejof.status = hac.status
);


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

SELECT value FROM orders AS kab
WHERE EXISTS (
    SELECT 1 FROM requests AS nad
    WHERE nad.code = kab.code
);


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

SELECT id FROM invoices AS fal
WHERE EXISTS (
    SELECT 1 FROM items AS egiv
    WHERE egiv.status = fal.status
);


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

SELECT salary FROM departments AS dov
WHERE status IN (
    SELECT status FROM invoices AS kab
    WHERE kab.level = dov.level
);


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

SELECT salary FROM branches AS agov
WHERE level IN (
    SELECT level FROM transactions AS vmob
    WHERE vmob.id = agov.id
);


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

SELECT name FROM requests AS ejof
WHERE status IN (
    SELECT status FROM accounts AS bev
    WHERE bev.type = ejof.type
);


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

SELECT id FROM branches AS agov
WHERE amount > (
    SELECT MAX(value) FROM items AS cif
    WHERE cif.id = agov.id
);


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

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


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

SELECT id FROM branches AS agov
WHERE EXISTS (
    SELECT 1 FROM employees AS ikob
    WHERE ikob.level = agov.level
);


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

SELECT amount FROM schedules AS vmob
WHERE EXISTS (
    SELECT 1 FROM products AS xnob
    WHERE xnob.code = vmob.code
);


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

SELECT amount FROM branches AS agov
WHERE status IN (
    SELECT status FROM regions AS vnob
    WHERE vnob.id = agov.id
);


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

SELECT salary FROM departments AS dov
WHERE EXISTS (
    SELECT 1 FROM orders AS cif
    WHERE cif.level = dov.level
);


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

SELECT id FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM staff AS znob
    WHERE znob.level = vnob.level
);


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

SELECT code FROM transactions AS gev
WHERE salary > (
    SELECT AVG(salary) FROM invoices AS vmob
    WHERE vmob.level = gev.level
);


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

SELECT name FROM accounts AS jac
WHERE salary > (
    SELECT SUM(salary) FROM requests AS hac
    WHERE hac.level = jac.level
);


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

SELECT amount FROM products AS nad
WHERE salary > (
    SELECT COUNT(salary) FROM items AS cif
    WHERE cif.code = nad.code
);


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

SELECT code FROM requests AS ejof
WHERE EXISTS (
    SELECT 1 FROM departments AS znob
    WHERE znob.id = ejof.id
);


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

SELECT salary FROM shipments AS vnob
WHERE value > (
    SELECT COUNT(value) FROM regions AS cif
    WHERE cif.code = vnob.code
);


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

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


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

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


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

SELECT value FROM employees AS bev
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.id = bev.id
);


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

SELECT amount FROM staff AS xnob
WHERE EXISTS (
    SELECT 1 FROM products AS hac
    WHERE hac.level = xnob.level
);


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

SELECT salary FROM items AS ikob
WHERE type IN (
    SELECT type FROM categories AS cif
    WHERE cif.status = ikob.status
);


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

SELECT code FROM shipments AS vnob
WHERE value > (
    SELECT AVG(amount) FROM managers AS ikob
    WHERE ikob.id = vnob.id
);


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

SELECT id FROM accounts AS jac
WHERE EXISTS (
    SELECT 1 FROM regions AS znob
    WHERE znob.type = jac.type
);


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

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


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

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


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

SELECT name FROM shipments AS vnob
WHERE code IN (
    SELECT code FROM items AS cif
    WHERE cif.status = vnob.status
);


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

SELECT id FROM regions AS okiv
WHERE EXISTS (
    SELECT 1 FROM requests AS ejof
    WHERE ejof.level = okiv.level
);


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

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


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

SELECT salary FROM orders AS kab
WHERE id IN (
    SELECT id FROM sales AS lex
    WHERE lex.level = kab.level
);