question_id
int64
1
75.7k
db_id
stringclasses
33 values
db_name
stringclasses
4 values
question
stringlengths
19
259
partition
stringclasses
4 values
difficulty
stringclasses
3 values
SQL
stringlengths
25
862
901
customers_and_orders
spider
What is the price for the product with name Monitor?
test
medium
SELECT product_price FROM products WHERE product_name = 'monitor'
902
customers_and_orders
spider
Give the price of the Monitor product.
test
medium
SELECT product_price FROM products WHERE product_name = 'monitor'
903
customers_and_orders
spider
Show the minimum, average, maximum price for all products.
test
easy
SELECT MIN(product_price), AVG(product_price), MAX(product_price) FROM products
904
customers_and_orders
spider
What are the minimum, average, and maximum prices across all products?
test
easy
SELECT MIN(product_price), AVG(product_price), MAX(product_price) FROM products
905
customers_and_orders
spider
What is the average price for products with type Clothes?
test
easy
SELECT AVG(product_price) FROM products WHERE product_type_code = 'clothes'
906
customers_and_orders
spider
Return the average price of Clothes.
test
easy
SELECT AVG(product_price) FROM products WHERE product_type_code = 'clothes'
907
customers_and_orders
spider
How many hardware type products do we have?
test
easy
SELECT COUNT(*) FROM products WHERE product_type_code = 'hardware'
908
customers_and_orders
spider
Count the number of products of the type Hardware.
test
easy
SELECT COUNT(*) FROM products WHERE product_type_code = 'hardware'
909
customers_and_orders
spider
Show all product names with price higher than the average.
test
easy
SELECT product_name FROM products WHERE product_price > (SELECT AVG(product_price) FROM products)
910
customers_and_orders
spider
What are the names of products that have a price above the average for all products.
test
easy
SELECT product_name FROM products WHERE product_price > (SELECT AVG(product_price) FROM products)
911
customers_and_orders
spider
Show all hardware product names with price higher than the average price of hardware type products.
test
medium
SELECT product_name FROM products WHERE product_type_code = 'hardware' AND product_price > (SELECT AVG(product_price) FROM products WHERE product_type_code = 'hardware')
912
customers_and_orders
spider
What are the names of Hardware product with prices above the average price of Hardware products.
test
medium
SELECT product_name FROM products WHERE product_type_code = 'hardware' AND product_price > (SELECT AVG(product_price) FROM products WHERE product_type_code = 'hardware')
913
customers_and_orders
spider
What is the name of the most expensive product with type Clothes?
test
easy
SELECT product_name FROM products WHERE product_type_code = 'clothes' ORDER BY product_price DESC LIMIT 1
914
customers_and_orders
spider
Give the name of the most expensive Clothes product.
test
easy
SELECT product_name FROM products WHERE product_type_code = 'clothes' ORDER BY product_price DESC LIMIT 1
915
customers_and_orders
spider
What is the product id and product name for the cheapest Hardware type product?
test
easy
SELECT product_id, product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price ASC LIMIT 1
916
customers_and_orders
spider
Give the id and name of the cheapest Hardware product.
test
easy
SELECT product_id, product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price ASC LIMIT 1
917
customers_and_orders
spider
List all product names in descending order of price.
test
hard
SELECT product_name FROM products ORDER BY product_price DESC
918
customers_and_orders
spider
What are the names of the products, sorted by descending price?
test
hard
SELECT product_name FROM products ORDER BY product_price DESC
919
customers_and_orders
spider
Show all hardware type products in ascending order of price.
test
easy
SELECT product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price ASC
920
customers_and_orders
spider
What are the names of all Hardware products, sorted by price ascending?
test
easy
SELECT product_name FROM products WHERE product_type_code = 'hardware' ORDER BY product_price ASC
921
customers_and_orders
spider
List all product type codes and the number of products in each type.
test
hard
SELECT product_type_code, COUNT(*) FROM products GROUP BY product_type_code
922
customers_and_orders
spider
How many products are there for each product type?
test
hard
SELECT product_type_code, COUNT(*) FROM products GROUP BY product_type_code
923
customers_and_orders
spider
Show all product type codes and the average price for each type.
test
hard
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
924
customers_and_orders
spider
What is the average price of products for each product type?
test
hard
SELECT product_type_code, AVG(product_price) FROM products GROUP BY product_type_code
925
customers_and_orders
spider
What are the product type code with at least two products?
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code HAVING COUNT(*) >= 2
926
customers_and_orders
spider
Give the product type codes of product types that have two or more products.
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code HAVING COUNT(*) >= 2
927
customers_and_orders
spider
What is the product type code with most number of products?
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code ORDER BY COUNT(*) DESC LIMIT 1
928
customers_and_orders
spider
What is the most frequent product type code?
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code ORDER BY COUNT(*) DESC LIMIT 1
929
customers_and_orders
spider
How many customers do we have?
test
easy
SELECT COUNT(*) FROM customers
930
customers_and_orders
spider
Count the number of customers.
test
easy
SELECT COUNT(*) FROM customers
931
customers_and_orders
spider
Show all customer ids and customer names.
test
easy
SELECT customer_id, customer_name FROM customers
932
customers_and_orders
spider
What are the ids and names of all customers?
test
easy
SELECT customer_id, customer_name FROM customers
933
customers_and_orders
spider
What is the customer address, customer phone, and customer email for Jeromy?
test
easy
SELECT customer_address, customer_phone, customer_email FROM customers WHERE customer_name = 'jeromy'
934
customers_and_orders
spider
Give the address, phone, and email for customers with the name Jeromy.
test
easy
SELECT customer_address, customer_phone, customer_email FROM customers WHERE customer_name = 'jeromy'
935
customers_and_orders
spider
Show all payment method codes and the number of customers in each code.
test
hard
SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code
936
customers_and_orders
spider
How many customers use each payment method?
test
hard
SELECT payment_method_code, COUNT(*) FROM customers GROUP BY payment_method_code
937
customers_and_orders
spider
What is the payment method code used by most number of customers?
test
hard
SELECT payment_method_code FROM customers GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1
938
customers_and_orders
spider
Give the code of the payment method that is most commonly used.
test
hard
SELECT payment_method_code FROM customers GROUP BY payment_method_code ORDER BY COUNT(*) DESC LIMIT 1
939
customers_and_orders
spider
Show all customer names with the payment method code used by least number of customers.
test
easy
SELECT customer_name FROM customers WHERE payment_method_code = (SELECT payment_method_code FROM customers GROUP BY payment_method_code ORDER BY COUNT(*) ASC LIMIT 1)
940
customers_and_orders
spider
What are the names of customers who use the least common payment method?
test
easy
SELECT customer_name FROM customers WHERE payment_method_code = (SELECT payment_method_code FROM customers GROUP BY payment_method_code ORDER BY COUNT(*) ASC LIMIT 1)
941
customers_and_orders
spider
What is the payment method and customer number for customer named Jeromy?
test
easy
SELECT payment_method_code, customer_number FROM customers WHERE customer_name = 'jeromy'
942
customers_and_orders
spider
Give the payment method code and customer number corresponding to the customer named Jeromy.
test
easy
SELECT payment_method_code, customer_number FROM customers WHERE customer_name = 'jeromy'
943
customers_and_orders
spider
What are the distinct payment methods used by customers?
test
easy
SELECT DISTINCT payment_method_code FROM customers
944
customers_and_orders
spider
Give the different payment method codes that customers use.
test
easy
SELECT DISTINCT payment_method_code FROM customers
945
customers_and_orders
spider
Show the id and the product type for all products, order by product name.
test
hard
SELECT product_id, product_type_code FROM products ORDER BY product_name
946
customers_and_orders
spider
What are the ids and product types for all products, sorted alphabetically by product name?
test
hard
SELECT product_id, product_type_code FROM products ORDER BY product_name
947
customers_and_orders
spider
What is the product type with least number of products?
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code ORDER BY COUNT(*) ASC LIMIT 1
948
customers_and_orders
spider
What is the code of the product type that is least common?
test
hard
SELECT product_type_code FROM products GROUP BY product_type_code ORDER BY COUNT(*) ASC LIMIT 1
949
customers_and_orders
spider
How many customer orders do we have?
test
easy
SELECT COUNT(*) FROM customer_orders
950
customers_and_orders
spider
Count the number of customer orders.
test
easy
SELECT COUNT(*) FROM customer_orders
951
customers_and_orders
spider
Show the order ids, order dates, and order status codes for all orders by customer Jeromy.
test
hard
SELECT order_id, order_date, order_status_code FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_name = 'jeromy'
952
customers_and_orders
spider
What were the ids, dates, and status codes for orders made by Jeromy?
test
hard
SELECT order_id, order_date, order_status_code FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id WHERE t2.customer_name = 'jeromy'
953
customers_and_orders
spider
Show all customer names, ids and the number of orders by each customer.
test
hard
SELECT t2.customer_name, t1.customer_id, COUNT(*) FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id
954
customers_and_orders
spider
What are the names, ids, and number of orders made for each customer?
test
hard
SELECT t2.customer_name, t1.customer_id, COUNT(*) FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id
955
customers_and_orders
spider
What is the customer id, name, phone, and email for the customer with most orders?
test
hard
SELECT t1.customer_id, t2.customer_name, t2.customer_phone, t2.customer_email FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
956
customers_and_orders
spider
Give the id, name, phone, and email corresponding to the customer who made the most orders.
test
hard
SELECT t1.customer_id, t2.customer_name, t2.customer_phone, t2.customer_email FROM customer_orders AS t1 JOIN customers AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.customer_id ORDER BY COUNT(*) DESC LIMIT 1
957
customers_and_orders
spider
Show all order status and the number of orders in each status.
test
hard
SELECT order_status_code, COUNT(*) FROM customer_orders GROUP BY order_status_code
958
customers_and_orders
spider
How many orders have each order status code?
test
hard
SELECT order_status_code, COUNT(*) FROM customer_orders GROUP BY order_status_code
959
customers_and_orders
spider
What is the order status code that is most common?
test
hard
SELECT order_status_code FROM customer_orders GROUP BY order_status_code ORDER BY COUNT(*) DESC LIMIT 1
960
customers_and_orders
spider
Give the order status code that is most frequent across customer orders.
test
hard
SELECT order_status_code FROM customer_orders GROUP BY order_status_code ORDER BY COUNT(*) DESC LIMIT 1
961
customers_and_orders
spider
How many customers do not have an order?
test
medium
SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_orders)
962
customers_and_orders
spider
Count the number of customers who have not made an order.
test
medium
SELECT COUNT(*) FROM customers WHERE NOT customer_id IN (SELECT customer_id FROM customer_orders)
963
customers_and_orders
spider
Show all product names without an order.
test
hard
SELECT product_name FROM products EXCEPT SELECT t1.product_name FROM products AS t1 JOIN order_items AS t2 ON t1.product_id = t2.product_id
964
customers_and_orders
spider
What are the names of products that have not been ordered?
test
hard
SELECT product_name FROM products EXCEPT SELECT t1.product_name FROM products AS t1 JOIN order_items AS t2 ON t1.product_id = t2.product_id
965
customers_and_orders
spider
How many products named Monitor have been ordered?
test
hard
SELECT SUM(order_quantity) FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id WHERE t2.product_name = 'monitor'
966
customers_and_orders
spider
What is the total number of Monitor products that have been ordered?
test
hard
SELECT SUM(order_quantity) FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id WHERE t2.product_name = 'monitor'
967
customers_and_orders
spider
How many customers have ordered the product named Monitor?
test
hard
SELECT COUNT(DISTINCT t3.customer_id) FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id JOIN customer_orders AS t3 ON t3.order_id = t1.order_id WHERE t2.product_name = 'monitor'
968
customers_and_orders
spider
Count the number of different customers who have bought a Monitor Product.
test
hard
SELECT COUNT(DISTINCT t3.customer_id) FROM order_items AS t1 JOIN products AS t2 ON t1.product_id = t2.product_id JOIN customer_orders AS t3 ON t3.order_id = t1.order_id WHERE t2.product_name = 'monitor'
969
customers_and_orders
spider
How many customers have an order?
test
easy
SELECT COUNT(DISTINCT customer_id) FROM customer_orders
970
customers_and_orders
spider
Count the number of differnt customers who have made an order.
test
easy
SELECT COUNT(DISTINCT customer_id) FROM customer_orders
971
customers_and_orders
spider
Show all customer ids without an order.
test
easy
SELECT customer_id FROM customers EXCEPT SELECT customer_id FROM customer_orders
972
customers_and_orders
spider
What are the ids of customers who have not made an order?
test
easy
SELECT customer_id FROM customers EXCEPT SELECT customer_id FROM customer_orders
973
customers_and_orders
spider
Show all the order dates and ids of the orders with quantity of any product larger than 6 or with more than 3 products.
test
hard
SELECT t1.order_date, t1.order_id FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t2.order_quantity > 6 UNION SELECT t1.order_date, t1.order_id FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id GROUP BY t1.order_id HAVING COUNT(*) > 3
974
customers_and_orders
spider
What are the order ids and corresponding order dates for orders with a quantity greater than 6 or consisting of more than 3 products?
test
hard
SELECT t1.order_date, t1.order_id FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id WHERE t2.order_quantity > 6 UNION SELECT t1.order_date, t1.order_id FROM customer_orders AS t1 JOIN order_items AS t2 ON t1.order_id = t2.order_id GROUP BY t1.order_id HAVING COUNT(*) > 3
975
restaurant_bills
spider
How many customers are there?
test
easy
SELECT COUNT(*) FROM customer
976
restaurant_bills
spider
Count the number of customers.
test
easy
SELECT COUNT(*) FROM customer
977
restaurant_bills
spider
List the names of customers in ascending order of level of membership.
test
hard
SELECT name FROM customer ORDER BY level_of_membership ASC
978
restaurant_bills
spider
Sort all the customers by the level of membership in ascending order, and return the customer names.
test
hard
SELECT name FROM customer ORDER BY level_of_membership ASC
979
restaurant_bills
spider
What are the nationalities and card credits of customers?
test
easy
SELECT nationality, card_credit FROM customer
980
restaurant_bills
spider
Find the nationality and card credit of each customer.
test
easy
SELECT nationality, card_credit FROM customer
981
restaurant_bills
spider
Show the names of customers with nationality "England" or "Australia".
test
medium
SELECT name FROM customer WHERE nationality = 'england' OR nationality = 'australia'
982
restaurant_bills
spider
Which customers have nationality "England" or "Australia"? Give me their names.
test
medium
SELECT name FROM customer WHERE nationality = 'england' OR nationality = 'australia'
983
restaurant_bills
spider
What is the average card credit of customers with membership level higher than 1?
test
easy
SELECT AVG(card_credit) FROM customer WHERE level_of_membership > 1
984
restaurant_bills
spider
Find the average card credit customers whose membership level is above 1.
test
easy
SELECT AVG(card_credit) FROM customer WHERE level_of_membership > 1
985
restaurant_bills
spider
What is the card credit of the customer with the highest membership level?
test
hard
SELECT card_credit FROM customer ORDER BY level_of_membership DESC LIMIT 1
986
restaurant_bills
spider
Find the customer with the highest membership level and return his or her card credit.
test
hard
SELECT card_credit FROM customer ORDER BY level_of_membership DESC LIMIT 1
987
restaurant_bills
spider
Show different nationalities of customers, along with the number of customers of each nationality.
test
hard
SELECT nationality, COUNT(*) FROM customer GROUP BY nationality
988
restaurant_bills
spider
How many customers are associated with each nationality? List the nationality and the number of customers.
test
hard
SELECT nationality, COUNT(*) FROM customer GROUP BY nationality
989
restaurant_bills
spider
Show the most common nationality of customers.
test
hard
SELECT nationality FROM customer GROUP BY nationality ORDER BY COUNT(*) DESC LIMIT 1
990
restaurant_bills
spider
Which nationality does the most customers have?
test
hard
SELECT nationality FROM customer GROUP BY nationality ORDER BY COUNT(*) DESC LIMIT 1
991
restaurant_bills
spider
Show the nations that have both customers with card credit smaller than 50 and customers with card credit bigger than 75.
test
easy
SELECT nationality FROM customer WHERE card_credit < 50 INTERSECT SELECT nationality FROM customer WHERE card_credit > 75
992
restaurant_bills
spider
Which nations have both customers with card credit above 50 and customers with card credit below 75.
test
easy
SELECT nationality FROM customer WHERE card_credit < 50 INTERSECT SELECT nationality FROM customer WHERE card_credit > 75
993
restaurant_bills
spider
Show the names of customers and names of dishes they order.
test
hard
SELECT t1.name, t2.dish_name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id
994
restaurant_bills
spider
For each order, return the customer name and the dish name.
test
hard
SELECT t1.name, t2.dish_name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id
995
restaurant_bills
spider
Show the names of customers and names of dishes they order, in descending order of the quantity of dish.
test
hard
SELECT t1.name, t2.dish_name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.quantity DESC
996
restaurant_bills
spider
For each order, find the customer name and the dish name. Sort the result in descending order of the quantity of dish.
test
hard
SELECT t1.name, t2.dish_name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id ORDER BY t2.quantity DESC
997
restaurant_bills
spider
Show each customer name and the total quantities of dishes ordered by that customer.
test
hard
SELECT t1.name, SUM(t2.quantity) FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.name
998
restaurant_bills
spider
What is the total quantities of dishes ordered by each customer ? List the customer name and the total quantity .
test
hard
SELECT t1.name, SUM(t2.quantity) FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.name
999
restaurant_bills
spider
Show the customers with total quantity of order bigger than 1.
test
hard
SELECT t1.name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.name HAVING SUM(t2.quantity) > 1
1,000
restaurant_bills
spider
Which customers have total order quantity greater than 1? Give me the customer names.
test
hard
SELECT t1.name FROM customer AS t1 JOIN customer_order AS t2 ON t1.customer_id = t2.customer_id GROUP BY t1.name HAVING SUM(t2.quantity) > 1