template_id stringclasses 18
values | question stringlengths 33 79 | gold_sql stringlengths 46 165 | prompt stringlengths 298 344 |
|---|---|---|---|
T10 | How many orders were placed in 2024? | SELECT COUNT(*) FROM orders WHERE strftime('%Y', order_date)='2024' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders were placed in 2024? |
T09 | Which customers in Chennai have placed at least one order? List their names. | SELECT DISTINCT c.name FROM customers c JOIN orders o ON o.customer_id=c.id WHERE c.city='Chennai' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which customers in Chennai have placed at least one ord... |
T21 | List customers in Bengaluru who are in the Retail segment. | SELECT name FROM customers WHERE city='Bengaluru' AND segment='Retail' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Bengaluru who are in the Retail segme... |
T08 | What is the total revenue from Grocery products? | SELECT SUM(oi.quantity*p.price) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.category='Grocery' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total revenue from Grocery products? |
T21 | List customers in Hyderabad who are in the Corporate segment. | SELECT name FROM customers WHERE city='Hyderabad' AND segment='Corporate' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Hyderabad who are in the Corporate se... |
T19 | How many orders did the customer 'Gautam Das' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Gautam Das' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Gautam Das' place? |
T19 | How many orders did the customer 'Manoj Patel' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Manoj Patel' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Manoj Patel' place? |
T22 | How many products cost less than 3000? | SELECT COUNT(*) FROM products WHERE price<3000 | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many products cost less than 3000? |
T19 | How many orders did the customer 'Vikram Reddy' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Vikram Reddy' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Vikram Reddy' place? |
T19 | How many orders did the customer 'Priya Kumar' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Priya Kumar' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Priya Kumar' place? |
T19 | How many orders did the customer 'Asha Sharma' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Asha Sharma' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Asha Sharma' place? |
T19 | How many orders did the customer 'Anita Menon' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Anita Menon' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Anita Menon' place? |
T22 | How many products cost less than 4000? | SELECT COUNT(*) FROM products WHERE price<4000 | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many products cost less than 4000? |
T21 | List customers in Ahmedabad who are in the Retail segment. | SELECT name FROM customers WHERE city='Ahmedabad' AND segment='Retail' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Ahmedabad who are in the Retail segme... |
T07 | What is the total quantity sold of the product 'Phone Mini'? | SELECT SUM(oi.quantity) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.name='Phone Mini' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity sold of the product 'Phone M... |
T19 | How many orders did the customer 'Meena Singh' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Meena Singh' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Meena Singh' place? |
T07 | What is the total quantity sold of the product 'Dress Classic'? | SELECT SUM(oi.quantity) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.name='Dress Classic' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity sold of the product 'Dress C... |
T13 | Which 3 products have the highest price? List their names. | SELECT name FROM products ORDER BY price DESC LIMIT 3 | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which 3 products have the highest price? List their nam... |
T01 | How many customers live in Kochi? | SELECT COUNT(*) FROM customers WHERE city='Kochi' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many customers live in Kochi? |
T11 | What is the total revenue in 2023? | SELECT SUM(oi.quantity*p.price) FROM orders o JOIN order_items oi ON oi.order_id=o.id JOIN products p ON p.id=oi.product_id WHERE strftime('%Y', o.order_date)='2023' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total revenue in 2023? |
T23 | How many orders with status 'Shipped' were placed in 2024? | SELECT COUNT(*) FROM orders WHERE status='Shipped' AND strftime('%Y', order_date)='2024' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders with status 'Shipped' were placed in 20... |
T06 | How many distinct customers have an order with status 'Delivered'? | SELECT COUNT(DISTINCT customer_id) FROM orders WHERE status='Delivered' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many distinct customers have an order with status '... |
T19 | How many orders did the customer 'Manoj Singh' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Manoj Singh' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Manoj Singh' place? |
T19 | How many orders did the customer 'Divya Kumar' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Divya Kumar' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Divya Kumar' place? |
T19 | How many orders did the customer 'Asha Rao' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Asha Rao' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Asha Rao' place? |
T21 | List customers in Coimbatore who are in the Startup segment. | SELECT name FROM customers WHERE city='Coimbatore' AND segment='Startup' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Coimbatore who are in the Startup seg... |
T21 | List customers in Kochi who are in the Corporate segment. | SELECT name FROM customers WHERE city='Kochi' AND segment='Corporate' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Kochi who are in the Corporate segmen... |
T20 | What is the total quantity of items ordered by customers in Pune? | SELECT SUM(oi.quantity) FROM customers c JOIN orders o ON o.customer_id=c.id JOIN order_items oi ON oi.order_id=o.id WHERE c.city='Pune' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity of items ordered by customer... |
T08 | What is the total revenue from Electronics products? | SELECT SUM(oi.quantity*p.price) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.category='Electronics' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total revenue from Electronics products? |
T21 | List customers in Jaipur who are in the Corporate segment. | SELECT name FROM customers WHERE city='Jaipur' AND segment='Corporate' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Jaipur who are in the Corporate segme... |
T21 | List customers in Coimbatore who are in the Retail segment. | SELECT name FROM customers WHERE city='Coimbatore' AND segment='Retail' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Coimbatore who are in the Retail segm... |
T05 | List products in the Clothing category priced above 500. | SELECT name FROM products WHERE category='Clothing' AND price>500 | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List products in the Clothing category priced above 500... |
T09 | Which customers in Pune have placed at least one order? List their names. | SELECT DISTINCT c.name FROM customers c JOIN orders o ON o.customer_id=c.id WHERE c.city='Pune' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which customers in Pune have placed at least one order?... |
T07 | What is the total quantity sold of the product 'Gloves Pro'? | SELECT SUM(oi.quantity) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.name='Gloves Pro' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity sold of the product 'Gloves ... |
T19 | How many orders did the customer 'Meena Nair' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Meena Nair' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Meena Nair' place? |
T07 | What is the total quantity sold of the product 'Bat Plus'? | SELECT SUM(oi.quantity) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.name='Bat Plus' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity sold of the product 'Bat Plu... |
T23 | How many orders with status 'Pending' were placed in 2023? | SELECT COUNT(*) FROM orders WHERE status='Pending' AND strftime('%Y', order_date)='2023' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders with status 'Pending' were placed in 20... |
T21 | List customers in Delhi who are in the Retail segment. | SELECT name FROM customers WHERE city='Delhi' AND segment='Retail' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List customers in Delhi who are in the Retail segment. |
T20 | What is the total quantity of items ordered by customers in Chennai? | SELECT SUM(oi.quantity) FROM customers c JOIN orders o ON o.customer_id=c.id JOIN order_items oi ON oi.order_id=o.id WHERE c.city='Chennai' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity of items ordered by customer... |
T19 | How many orders did the customer 'Karthik Patel' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Karthik Patel' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Karthik Patel' place? |
T09 | Which customers in Mumbai have placed at least one order? List their names. | SELECT DISTINCT c.name FROM customers c JOIN orders o ON o.customer_id=c.id WHERE c.city='Mumbai' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which customers in Mumbai have placed at least one orde... |
T19 | How many orders did the customer 'Pooja Reddy' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Pooja Reddy' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Pooja Reddy' place? |
T09 | Which customers in Delhi have placed at least one order? List their names. | SELECT DISTINCT c.name FROM customers c JOIN orders o ON o.customer_id=c.id WHERE c.city='Delhi' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which customers in Delhi have placed at least one order... |
T05 | List products in the Clothing category priced above 2500. | SELECT name FROM products WHERE category='Clothing' AND price>2500 | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: List products in the Clothing category priced above 250... |
T07 | What is the total quantity sold of the product 'Jacket Plus'? | SELECT SUM(oi.quantity) FROM order_items oi JOIN products p ON p.id=oi.product_id WHERE p.name='Jacket Plus' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: What is the total quantity sold of the product 'Jacket ... |
T19 | How many orders did the customer 'Sanjay Patel' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Sanjay Patel' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Sanjay Patel' place? |
T09 | Which customers in Jaipur have placed at least one order? List their names. | SELECT DISTINCT c.name FROM customers c JOIN orders o ON o.customer_id=c.id WHERE c.city='Jaipur' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: Which customers in Jaipur have placed at least one orde... |
T19 | How many orders did the customer 'Rekha Sharma' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Rekha Sharma' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Rekha Sharma' place? |
T01 | How many customers live in Delhi? | SELECT COUNT(*) FROM customers WHERE city='Delhi' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many customers live in Delhi? |
T19 | How many orders did the customer 'Gautam Rao' place? | SELECT COUNT(*) FROM orders o JOIN customers c ON c.id=o.customer_id WHERE c.name='Gautam Rao' | Database schema (SQLite):
customers(id, name, city, segment, signup_date)
products(id, name, category, price)
orders(id, customer_id, order_date, status)
order_items(id, order_id, product_id, quantity)
Write one SQLite SELECT query inside a ```sql block.
Question: How many orders did the customer 'Gautam Rao' place? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.