[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: List all employees in department 1.

[Assistant] SELECT * FROM employees WHERE department_id = 1;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Which software products cost less than 500 dollars?

[Assistant] SELECT * FROM products WHERE category = 'Software' AND price < 500;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: How many departments do not have a manager?

[Assistant] SELECT COUNT(*) FROM departments WHERE manager_id IS NULL;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Find the total salary budget for the Engineering department.

[Assistant] SELECT SUM(e.salary) FROM employees e JOIN departments d ON e.department_id = d.id WHERE d.name = 'Engineering';


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: What is the total quantity of CRM products sold in 2024?

[Assistant] SELECT SUM(s.quantity) FROM sales s JOIN products p ON s.product_id = p.id WHERE p.name = 'Enterprise CRM' AND s.sale_date BETWEEN '2024-01-01' AND '2024-12-31';


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Show the employee with the highest salary in department 2.

[Assistant] SELECT name, salary FROM employees WHERE department_id = 2 ORDER BY salary DESC LIMIT 1;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: List employees who report directly to Alice Vance.

[Assistant] SELECT e.name FROM employees e JOIN employees m ON e.manager_id = m.id WHERE m.name = 'Alice Vance';


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Find the average sale amount for employee ID 9.

[Assistant] SELECT AVG(amount) FROM sales WHERE employee_id = 9;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Find the total revenue generated from software category products.

[Assistant] SELECT SUM(s.amount) FROM sales s JOIN products p ON s.product_id = p.id WHERE p.category = 'Software';


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Which product has the lowest price?

[Assistant] SELECT name, price FROM products ORDER BY price ASC LIMIT 1;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: Find the employee who generated the highest total revenue across all sales.

[Assistant] SELECT e.name, SUM(s.amount) AS total_revenue FROM employees e JOIN sales s ON e.id = s.employee_id GROUP BY e.name ORDER BY total_revenue DESC LIMIT 1;


[User]
You are a Text-to-SQL generator. Given a database schema and a natural language question, write a valid SQLite query that answers the question. Do not explain the query, just output the raw SQL.

Database Schema:
Table departments:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Sales', 'Engineering', etc.)
  - manager_id: INTEGER (references employees.id)

Table employees:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL)
  - department_id: INTEGER (references departments.id)
  - salary: INTEGER (NOT NULL)
  - hire_date: TEXT (NOT NULL, YYYY-MM-DD)
  - manager_id: INTEGER (references employees.id)

Table products:
  - id: INTEGER (PRIMARY KEY)
  - name: TEXT (NOT NULL, UNIQUE, e.g., 'Enterprise CRM')
  - category: TEXT (NOT NULL, e.g., 'Software', 'Hardware', 'Cloud')
  - price: REAL (NOT NULL)

Table sales:
  - id: INTEGER (PRIMARY KEY)
  - employee_id: INTEGER (NOT NULL, references employees.id)
  - product_id: INTEGER (NOT NULL, references products.id)
  - amount: REAL (NOT NULL)
  - quantity: INTEGER (NOT NULL)
  - sale_date: TEXT (NOT NULL, YYYY-MM-DD)

Question: List products sold in November 2024.

[Assistant] SELECT DISTINCT p.name FROM products p JOIN sales s ON p.id = s.product_id WHERE s.sale_date BETWEEN '2024-11-01' AND '2024-11-30';