[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] How many regions are there in the database?

[Assistant] SELECT COUNT(*) FROM regions;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List all region names.

[Assistant] SELECT region_name FROM regions;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve region_ids and names for regions starting with 'West'.

[Assistant] SELECT region_id, region_name FROM regions WHERE region_name LIKE 'West%';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show me region names in alphabetical order.

[Assistant] SELECT region_name FROM regions ORDER BY region_name ASC;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Count regions whose names contain 'East'.

[Assistant] SELECT COUNT(*) FROM regions WHERE region_name LIKE '%East%';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Get the maximum region_id.

[Assistant] SELECT MAX(region_id) FROM regions;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Select all regions with region_id > 3.

[Assistant] SELECT * FROM regions WHERE region_id > 3;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve the second highest region_id.

[Assistant] SELECT region_id FROM regions ORDER BY region_id DESC LIMIT 1 OFFSET 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List the first three regions by ID.

[Assistant] SELECT * FROM regions ORDER BY region_id ASC LIMIT 3;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List region names in reverse alphabetical order.

[Assistant] SELECT region_name FROM regions ORDER BY region_name DESC;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Which regions have even IDs?

[Assistant] SELECT * FROM regions WHERE region_id % 2 = 0;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] How many products are available?

[Assistant] SELECT COUNT(*) FROM products;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List all product names and categories.

[Assistant] SELECT product_name, category FROM products;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find products priced above 100.

[Assistant] SELECT * FROM products WHERE price > 100;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Average product price per category.

[Assistant] SELECT category, AVG(price) FROM products GROUP BY category;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve the most expensive product.

[Assistant] SELECT * FROM products ORDER BY price DESC LIMIT 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Count how many 'Electronics' products exist.

[Assistant] SELECT COUNT(*) FROM products WHERE category = 'Electronics';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show products priced between 50 and 150.

[Assistant] SELECT * FROM products WHERE price BETWEEN 50 AND 150;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List categories and product counts.

[Assistant] SELECT category, COUNT(*) FROM products GROUP BY category;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Get the total sum of all product prices.

[Assistant] SELECT SUM(price) FROM products;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve the cheapest product name.

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


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Which products end with 'Pro'?

[Assistant] SELECT product_name FROM products WHERE product_name LIKE '%Pro';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] How many customers are registered?

[Assistant] SELECT COUNT(*) FROM customers;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List all customer names and emails.

[Assistant] SELECT customer_name, email FROM customers;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find customers in region 2.

[Assistant] SELECT * FROM customers WHERE region_id = 2;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show customers with an email address.

[Assistant] SELECT customer_name FROM customers WHERE email IS NOT NULL;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Count customers per region.

[Assistant] SELECT region_id, COUNT(*) FROM customers GROUP BY region_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List customers whose name starts with 'A'.

[Assistant] SELECT * FROM customers WHERE customer_name LIKE 'A%';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve emails sorted alphabetically.

[Assistant] SELECT email FROM customers WHERE email IS NOT NULL ORDER BY email ASC;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Get the most recent customer by ID.

[Assistant] SELECT * FROM customers ORDER BY customer_id DESC LIMIT 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Which customers have no region assigned?

[Assistant] SELECT * FROM customers WHERE region_id IS NULL;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] How many sales have occurred?

[Assistant] SELECT COUNT(*) FROM sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List sale_id, sale_date, and amount for all sales.

[Assistant] SELECT sale_id, sale_date, amount FROM sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find sales between '2025-01-01' and '2025-06-01'.

[Assistant] SELECT * FROM sales WHERE sale_date BETWEEN '2025-01-01' AND '2025-06-01';


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Sum total sales amount by region.

[Assistant] SELECT region_id, SUM(amount) FROM sales GROUP BY region_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Average quantity sold per product.

[Assistant] SELECT product_id, AVG(quantity) FROM sales GROUP BY product_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Retrieve the highest single sale amount.

[Assistant] SELECT MAX(amount) FROM sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Count sales for customer 5.

[Assistant] SELECT COUNT(*) FROM sales WHERE customer_id = 5;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show sales of product 3 ordered by date descending.

[Assistant] SELECT * FROM sales WHERE product_id = 3 ORDER BY sale_date DESC;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Get the total amount for all sales.

[Assistant] SELECT SUM(amount) FROM sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] What was the quantity sold on the earliest sale?

[Assistant] SELECT quantity FROM sales ORDER BY sale_date ASC LIMIT 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] For each customer, show total sales amount.

[Assistant] SELECT customer_id, SUM(amount) FROM sales GROUP BY customer_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List top 5 customers by total amount spent.

[Assistant] SELECT customer_id, SUM(amount) as total_spent FROM sales GROUP BY customer_id ORDER BY total_spent DESC LIMIT 5;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Join customers and sales to get names and sale amounts.

[Assistant] SELECT c.customer_name, s.amount FROM customers c JOIN sales s ON c.customer_id = s.customer_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find the most popular product by sales count.

[Assistant] SELECT product_id, COUNT(*) as cnt FROM sales GROUP BY product_id ORDER BY cnt DESC LIMIT 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show average sale amount per region for May 2025.

[Assistant] SELECT region_id, AVG(amount) FROM sales WHERE sale_date LIKE '2025-05-%' GROUP BY region_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List the sale_date and customer_name for every sale.

[Assistant] SELECT s.sale_date, c.customer_name FROM sales s JOIN customers c ON s.customer_id = c.customer_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show customer_name, product_name, quantity, and amount for each sale.

[Assistant] SELECT c.customer_name, p.product_name, s.quantity, s.amount FROM sales s JOIN customers c ON s.customer_id = c.customer_id JOIN products p ON s.product_id = p.product_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Calculate total sales amount per product category.

[Assistant] SELECT p.category, SUM(s.amount) AS total_revenue FROM sales s JOIN products p ON s.product_id = p.product_id GROUP BY p.category;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Get the top 3 product categories by total revenue.

[Assistant] SELECT p.category, SUM(s.amount) AS revenue FROM sales s JOIN products p ON s.product_id = p.product_id GROUP BY p.category ORDER BY revenue DESC LIMIT 3;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List customer_name and region_name for all sales over 100.

[Assistant] SELECT c.customer_name, r.region_name FROM sales s JOIN customers c ON s.customer_id = c.customer_id JOIN regions r ON s.region_id = r.region_id WHERE s.amount > 100;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find all products that have never been sold.

[Assistant] SELECT p.product_name FROM products p LEFT JOIN sales s ON p.product_id = s.product_id WHERE s.sale_id IS NULL;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List regions that had no sales in June 2025.

[Assistant] SELECT r.region_name FROM regions r LEFT JOIN sales s ON r.region_id = s.region_id AND s.sale_date LIKE '2025-06-%' WHERE s.sale_id IS NULL;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Show a running total of amount over sale_date.

[Assistant] SELECT sale_date, amount, SUM(amount) OVER (ORDER BY sale_date) AS running_total FROM sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Rank customers by total spent.

[Assistant] SELECT customer_id, SUM(amount) AS total_spent, RANK() OVER (ORDER BY SUM(amount) DESC) AS rank FROM sales GROUP BY customer_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Calculate the average sale amount per calendar month.

[Assistant] SELECT SUBSTR(sale_date,1,7) AS month, AVG(amount) FROM sales GROUP BY month;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Compute each region’s percentage of total sales amount.

[Assistant] SELECT region_id, SUM(amount)*100.0/(SELECT SUM(amount) FROM sales) AS pct_of_total FROM sales GROUP BY region_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] For each product, show its price and the average sale amount.

[Assistant] SELECT p.product_name, p.price, (SELECT AVG(amount) FROM sales WHERE product_id = p.product_id) AS avg_sale FROM products p;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List customers who spent more than the average customer.

[Assistant] SELECT DISTINCT c.customer_name FROM customers c WHERE (SELECT SUM(amount) FROM sales WHERE customer_id = c.customer_id) > (SELECT AVG(total) FROM (SELECT SUM(amount) AS total FROM sales GROUP BY customer_id));


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Use a CTE to show monthly total sales.

[Assistant] WITH monthly_sales AS (SELECT SUBSTR(sale_date,1,7) AS month, SUM(amount) AS total FROM sales GROUP BY month) SELECT * FROM monthly_sales;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Use a CTE to find the top 5 products by revenue.

[Assistant] WITH prod_rev AS (SELECT product_id, SUM(amount) AS revenue FROM sales GROUP BY product_id) SELECT p.product_name, pr.revenue FROM prod_rev pr JOIN products p ON pr.product_id = p.product_id ORDER BY pr.revenue DESC LIMIT 5;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find each customer’s first sale date.

[Assistant] SELECT customer_id, MIN(sale_date) AS first_sale FROM sales GROUP BY customer_id;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Identify repeat customers (more than one sale).

[Assistant] SELECT customer_id FROM sales GROUP BY customer_id HAVING COUNT(*) > 1;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Find customers who purchased both product 1 and product 2.

[Assistant] SELECT DISTINCT s1.customer_id FROM sales s1 JOIN sales s2 ON s1.customer_id = s2.customer_id WHERE s1.product_id = 1 AND s2.product_id = 2;


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] List products sold in every region.

[Assistant] SELECT product_id FROM sales GROUP BY product_id HAVING COUNT(DISTINCT region_id) = (SELECT COUNT(*) FROM regions);


[System] You are a helpful assistant that translates natural language queries into executable SQL queries. Only respond with the SQL query.

[User] Determine which region has the highest average sale amount.

[Assistant] SELECT region_id FROM sales GROUP BY region_id ORDER BY AVG(amount) DESC LIMIT 1;