query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
0 |
soccer_3
|
[
"club"
] |
How many clubs are there?
|
SELECT count(*) FROM club
|
easy
|
1 |
soccer_3
|
[
"club"
] |
Count the number of clubs.
|
SELECT count(*) FROM club
|
easy
|
2 |
soccer_3
|
[
"club"
] |
List the name of clubs in ascending alphabetical order.
|
SELECT Name FROM club ORDER BY Name ASC
|
easy
|
3 |
soccer_3
|
[
"club"
] |
What are the names of clubs, ordered alphabetically?
|
SELECT Name FROM club ORDER BY Name ASC
|
easy
|
4 |
soccer_3
|
[
"club"
] |
What are the managers and captains of clubs?
|
SELECT Manager , Captain FROM club
|
medium
|
5 |
soccer_3
|
[
"club"
] |
Return the managers and captains of all clubs.
|
SELECT Manager , Captain FROM club
|
medium
|
6 |
soccer_3
|
[
"club"
] |
List the name of clubs whose manufacturer is not "Nike"
|
SELECT Name FROM club WHERE Manufacturer != "Nike"
|
easy
|
7 |
soccer_3
|
[
"club"
] |
What are the names of clubs who do not have the manufacturer Nike?
|
SELECT Name FROM club WHERE Manufacturer != "Nike"
|
easy
|
8 |
soccer_3
|
[
"player"
] |
What are the names of players in ascending order of wins count?
|
SELECT Name FROM player ORDER BY Wins_count ASC
|
easy
|
9 |
soccer_3
|
[
"player"
] |
Return the names of players in order of count of wins, ascending.
|
SELECT Name FROM player ORDER BY Wins_count ASC
|
easy
|
10 |
soccer_3
|
[
"player"
] |
What is the name of the player with the highest earnings?
|
SELECT Name FROM player ORDER BY Earnings DESC LIMIT 1
|
medium
|
11 |
soccer_3
|
[
"player"
] |
Return the name of the player who earns the most money.
|
SELECT Name FROM player ORDER BY Earnings DESC LIMIT 1
|
medium
|
12 |
soccer_3
|
[
"player"
] |
What are the distinct countries of players with earnings higher than 1200000?
|
SELECT DISTINCT Country FROM player WHERE Earnings > 1200000
|
easy
|
13 |
soccer_3
|
[
"player"
] |
From which countries are players who make more than 1200000 from?
|
SELECT DISTINCT Country FROM player WHERE Earnings > 1200000
|
easy
|
14 |
soccer_3
|
[
"player"
] |
What is the country of the player with the highest earnings among players that have more than 2 win counts?
|
SELECT Country FROM player WHERE Wins_count > 2 ORDER BY Earnings DESC LIMIT 1
|
hard
|
15 |
soccer_3
|
[
"player"
] |
Of players who have more than 2 wins, what is the country of the player who makes the most?
|
SELECT Country FROM player WHERE Wins_count > 2 ORDER BY Earnings DESC LIMIT 1
|
hard
|
16 |
soccer_3
|
[
"club",
"player"
] |
Show names of players and names of clubs they are in.
|
SELECT T2.Name , T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
|
medium
|
17 |
soccer_3
|
[
"club",
"player"
] |
What are the names of players and the corresponding clubs that they are in?
|
SELECT T2.Name , T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID
|
medium
|
18 |
soccer_3
|
[
"club",
"player"
] |
Show names of clubs that have players with more than 2 win counts.
|
SELECT T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Wins_count > 2
|
medium
|
19 |
soccer_3
|
[
"club",
"player"
] |
What are the names of clubs that have players who have won more than twice?
|
SELECT T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T2.Wins_count > 2
|
medium
|
20 |
soccer_3
|
[
"club",
"player"
] |
Show names of players from the club with manager "Sam Allardyce".
|
SELECT T2.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.Manager = "Sam Allardyce"
|
medium
|
21 |
soccer_3
|
[
"club",
"player"
] |
What are the names of players from the club managed by Sam Allardyce?
|
SELECT T2.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID WHERE T1.Manager = "Sam Allardyce"
|
medium
|
22 |
soccer_3
|
[
"club",
"player"
] |
Show names of clubs in descending order of average earnings of players belonging.
|
SELECT T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID GROUP BY T1.Club_ID ORDER BY avg(T2.Earnings) DESC
|
hard
|
23 |
soccer_3
|
[
"club",
"player"
] |
What are the names of clubs, ordered descending by the average earnings of players within each?
|
SELECT T1.Name FROM club AS T1 JOIN player AS T2 ON T1.Club_ID = T2.Club_ID GROUP BY T1.Club_ID ORDER BY avg(T2.Earnings) DESC
|
hard
|
24 |
soccer_3
|
[
"club"
] |
Show different manufacturers and the number of clubs they are associated with.
|
SELECT Manufacturer , COUNT(*) FROM club GROUP BY Manufacturer
|
medium
|
25 |
soccer_3
|
[
"club"
] |
How many clubs use each manufacturer?
|
SELECT Manufacturer , COUNT(*) FROM club GROUP BY Manufacturer
|
medium
|
26 |
soccer_3
|
[
"club"
] |
Please show the most common manufacturer of clubs.
|
SELECT Manufacturer FROM club GROUP BY Manufacturer ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
27 |
soccer_3
|
[
"club"
] |
Which manufacturer is most common among clubs?
|
SELECT Manufacturer FROM club GROUP BY Manufacturer ORDER BY COUNT(*) DESC LIMIT 1
|
hard
|
28 |
soccer_3
|
[
"club"
] |
List the manufacturers that are associated with more than one club.
|
SELECT Manufacturer FROM club GROUP BY Manufacturer HAVING COUNT(*) > 1
|
easy
|
29 |
soccer_3
|
[
"club"
] |
Which manufacturers work for more than 1 club?
|
SELECT Manufacturer FROM club GROUP BY Manufacturer HAVING COUNT(*) > 1
|
easy
|
30 |
soccer_3
|
[
"player"
] |
List the country that have more than one player.
|
SELECT Country FROM player GROUP BY Country HAVING COUNT(*) > 1
|
easy
|
31 |
soccer_3
|
[
"player"
] |
Which countries have produced more than one player?
|
SELECT Country FROM player GROUP BY Country HAVING COUNT(*) > 1
|
easy
|
32 |
soccer_3
|
[
"club",
"player"
] |
List the name of clubs that do not have players.
|
SELECT Name FROM club WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
|
hard
|
33 |
soccer_3
|
[
"club",
"player"
] |
What are the names of clubs that do not have any players?
|
SELECT Name FROM club WHERE Club_ID NOT IN (SELECT Club_ID FROM player)
|
hard
|
34 |
soccer_3
|
[
"player"
] |
Show the country of players with earnings more than 1400000 and players with earnings less than 1100000.
|
SELECT Country FROM player WHERE Earnings > 1400000 INTERSECT SELECT Country FROM player WHERE Earnings < 1100000
|
hard
|
35 |
soccer_3
|
[
"player"
] |
Which country has produced both players with earnings over 1400000 and players with earnings below 1100000?
|
SELECT Country FROM player WHERE Earnings > 1400000 INTERSECT SELECT Country FROM player WHERE Earnings < 1100000
|
hard
|
36 |
soccer_3
|
[
"player"
] |
What is the number of distinct countries of all players?
|
SELECT COUNT (DISTINCT Country) FROM player
|
easy
|
37 |
soccer_3
|
[
"player"
] |
How many different countries are players from?
|
SELECT COUNT (DISTINCT Country) FROM player
|
easy
|
38 |
soccer_3
|
[
"player"
] |
Show the earnings of players from country "Australia" or "Zimbabwe".
|
SELECT Earnings FROM player WHERE Country = "Australia" OR Country = "Zimbabwe"
|
medium
|
39 |
soccer_3
|
[
"player"
] |
What are the earnings of players from either of the countries of Australia or Zimbabwe?
|
SELECT Earnings FROM player WHERE Country = "Australia" OR Country = "Zimbabwe"
|
medium
|
40 |
e_commerce
|
[
"order_items",
"orders",
"customers"
] |
List the id, first name and last name of the customers who both have placed more than 2 orders and have bought at least 3 items.
|
SELECT T1.customer_id , T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2 INTERSECT SELECT T1.customer_id , T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING count(*) >= 3
|
extra
|
41 |
e_commerce
|
[
"order_items",
"orders",
"customers"
] |
What are the ids, first and last names of the customers who have ordered more than twice and have bought at least 3 items?
|
SELECT T1.customer_id , T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.customer_id HAVING count(*) > 2 INTERSECT SELECT T1.customer_id , T1.customer_first_name , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.customer_id HAVING count(*) >= 3
|
extra
|
42 |
e_commerce
|
[
"order_items",
"orders"
] |
For the orders with any produts, how many products does each orders contain ? List the order id, status and the number.
|
SELECT T1.order_id , T1.order_status_code , count(*) FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id
|
medium
|
43 |
e_commerce
|
[
"order_items",
"orders"
] |
For every order, how many products does it contain, and what are the orders' statuses and ids?
|
SELECT T1.order_id , T1.order_status_code , count(*) FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id
|
medium
|
44 |
e_commerce
|
[
"order_items",
"orders"
] |
List the dates of the orders which were placed at the earliest time or have more than 1 items.
|
SELECT min(date_order_placed) FROM Orders UNION SELECT T1.date_order_placed FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) > 1
|
hard
|
45 |
e_commerce
|
[
"order_items",
"orders"
] |
What are the dates of the earliest order and the dates of all orders with more than 1 item?
|
SELECT min(date_order_placed) FROM Orders UNION SELECT T1.date_order_placed FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) > 1
|
hard
|
46 |
e_commerce
|
[
"orders",
"customers"
] |
Which customers did not make any orders? List the first name, middle initial and last name.
|
SELECT customer_first_name , customer_middle_initial , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id
|
extra
|
47 |
e_commerce
|
[
"orders",
"customers"
] |
WHat are the first and last names, and middle initials of all customers who did not make any orders?
|
SELECT customer_first_name , customer_middle_initial , customer_last_name FROM Customers EXCEPT SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id
|
extra
|
48 |
e_commerce
|
[
"order_items",
"orders",
"products"
] |
What are the id, name, price and color of the products which have not been ordered for at least twice?
|
SELECT product_id , product_name , product_price , product_color FROM Products EXCEPT SELECT T1.product_id , T1.product_name , T1.product_price , T1.product_color FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T2.order_id = T3.order_id GROUP BY T1.product_id HAVING count(*) >= 2
|
extra
|
49 |
e_commerce
|
[
"orders",
"products",
"order_items"
] |
What are the ids , names , prices , and colors of all products that have been listed in less than two orders ?
|
select t1.product_id , t1.product_name , t1.product_price , t1.product_color from products as t1 join order_items as t2 on t1.product_id = t2.product_id join orders as t3 on t2.order_id = t3.order_id group by t1.product_id having count(*) < 2
|
hard
|
50 |
e_commerce
|
[
"order_items",
"orders"
] |
Which orders have at least 2 products on it? List the order id and date.
|
SELECT T1.order_id , T1.date_order_placed FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) >= 2
|
medium
|
51 |
e_commerce
|
[
"order_items",
"orders"
] |
What are the ids and dates of the orders with at least two products?
|
SELECT T1.order_id , T1.date_order_placed FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id GROUP BY T1.order_id HAVING count(*) >= 2
|
medium
|
52 |
e_commerce
|
[
"order_items",
"products"
] |
Which product are listed in orders most frequently? List the id, product name and price.
|
SELECT T1.product_id , T1.product_name , T1.product_price FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
53 |
e_commerce
|
[
"order_items",
"products"
] |
What are the ids, names, and prices of all products that are ordered most frequently?
|
SELECT T1.product_id , T1.product_name , T1.product_price FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id GROUP BY T1.product_id ORDER BY count(*) DESC LIMIT 1
|
extra
|
54 |
e_commerce
|
[
"order_items",
"products"
] |
Which order have the least sum of the product prices. List the order id and sum.
|
SELECT T1.order_id , sum(T2.product_price) FROM Order_items AS T1 JOIN Products AS T2 ON T1.product_id = T2.product_id GROUP BY T1.order_id ORDER BY sum(T2.product_price) ASC LIMIT 1
|
extra
|
55 |
e_commerce
|
[
"products",
"order_items"
] |
What is the order that total cost the least , and how much is the total cost ?
|
select t1.order_id , sum(t2.product_price) from order_items as t1 join products as t2 on t1.product_id = t2.product_id group by t1.order_id order by sum(t2.product_price) asc limit 1
|
extra
|
56 |
e_commerce
|
[
"customer_payment_methods"
] |
What is the most popular payment method?
|
SELECT Payment_method_code FROM Customer_Payment_Methods GROUP BY Payment_method_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
57 |
e_commerce
|
[
"customer_payment_methods"
] |
What is the payment method that most customers use?
|
SELECT Payment_method_code FROM Customer_Payment_Methods GROUP BY Payment_method_code ORDER BY count(*) DESC LIMIT 1
|
hard
|
58 |
e_commerce
|
[
"order_items",
"orders",
"customers"
] |
How many number of products does each gender of customers buy? List the gender and the number
|
SELECT T1.gender_code , count(*) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.gender_code
|
hard
|
59 |
e_commerce
|
[
"order_items",
"orders",
"customers"
] |
How many products does each gender buy?
|
SELECT T1.gender_code , count(*) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id GROUP BY T1.gender_code
|
hard
|
60 |
e_commerce
|
[
"orders",
"customers"
] |
How many orders has each gender of customers placed?
|
SELECT T1.gender_code , count(*) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.gender_code
|
medium
|
61 |
e_commerce
|
[
"orders",
"customers"
] |
How many orders has each gender placed?
|
SELECT T1.gender_code , count(*) FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.gender_code
|
medium
|
62 |
e_commerce
|
[
"customer_payment_methods",
"customers"
] |
List the customers' first name, middle initial, last name and payment methods.
|
SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name , T2.Payment_method_code FROM Customers AS T1 JOIN Customer_Payment_Methods AS T2 ON T1.customer_id = T2.customer_id
|
medium
|
63 |
e_commerce
|
[
"customer_payment_methods",
"customers"
] |
What are the first names, middle initials, last names, and payment methods of all customers?
|
SELECT T1.customer_first_name , T1.customer_middle_initial , T1.customer_last_name , T2.Payment_method_code FROM Customers AS T1 JOIN Customer_Payment_Methods AS T2 ON T1.customer_id = T2.customer_id
|
medium
|
64 |
e_commerce
|
[
"shipments",
"invoices"
] |
List the invoices' status, date and the date of shipment.
|
SELECT T1.invoice_status_code , T1.invoice_date , T2.shipment_date FROM Invoices AS T1 JOIN Shipments AS T2 ON T1.invoice_number = T2.invoice_number
|
medium
|
65 |
e_commerce
|
[
"shipments",
"invoices"
] |
What are the statuses, dates, and shipment dates for all invoices?
|
SELECT T1.invoice_status_code , T1.invoice_date , T2.shipment_date FROM Invoices AS T1 JOIN Shipments AS T2 ON T1.invoice_number = T2.invoice_number
|
medium
|
66 |
e_commerce
|
[
"order_items",
"products",
"shipments",
"shipment_items"
] |
List the names of the products being shipped and the corresponding shipment date.
|
SELECT T1.product_name , T4.shipment_date FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Shipment_Items AS T3 ON T2.order_item_id = T3.order_item_id JOIN Shipments AS T4 ON T3.shipment_id = T4.shipment_id
|
hard
|
67 |
e_commerce
|
[
"order_items",
"products",
"shipments",
"shipment_items"
] |
What are the names of the products tht have been shipped, and on what days were they shipped?
|
SELECT T1.product_name , T4.shipment_date FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Shipment_Items AS T3 ON T2.order_item_id = T3.order_item_id JOIN Shipments AS T4 ON T3.shipment_id = T4.shipment_id
|
hard
|
68 |
e_commerce
|
[
"order_items",
"shipments",
"shipment_items"
] |
What is the status code of the items being ordered and shipped and its corresponding shipment tracking number?
|
SELECT T1.order_item_status_code , T3.shipment_tracking_number FROM Order_items AS T1 JOIN Shipment_Items AS T2 ON T1.order_item_id = T2.order_item_id JOIN Shipments AS T3 ON T2.shipment_id = T3.shipment_id
|
medium
|
69 |
e_commerce
|
[
"order_items",
"shipments",
"shipment_items"
] |
What is the status code of the items have been ordered and shipped, and also what are their shipment tracking numbers?
|
SELECT T1.order_item_status_code , T3.shipment_tracking_number FROM Order_items AS T1 JOIN Shipment_Items AS T2 ON T1.order_item_id = T2.order_item_id JOIN Shipments AS T3 ON T2.shipment_id = T3.shipment_id
|
medium
|
70 |
e_commerce
|
[
"order_items",
"products",
"shipments",
"shipment_items"
] |
What is the product name and the color of the ordered items which have been shipped?
|
SELECT T1.product_name , T1.product_color FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Shipment_Items AS T3 ON T2.order_item_id = T3.order_item_id JOIN Shipments AS T4 ON T3.shipment_id = T4.shipment_id
|
hard
|
71 |
e_commerce
|
[
"order_items",
"products",
"shipments",
"shipment_items"
] |
What are the names and colors of all products that have been shipped?
|
SELECT T1.product_name , T1.product_color FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Shipment_Items AS T3 ON T2.order_item_id = T3.order_item_id JOIN Shipments AS T4 ON T3.shipment_id = T4.shipment_id
|
hard
|
72 |
e_commerce
|
[
"order_items",
"orders",
"products",
"customers"
] |
List all the distinct product names, price and descriptions which are bought by female customers.
|
SELECT DISTINCT T1.product_name , T1.product_price , T1.product_description FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T2.order_id = T3.order_id JOIN Customers AS T4 ON T3.customer_id = T4.customer_id WHERE T4.gender_code = 'Female'
|
extra
|
73 |
e_commerce
|
[
"order_items",
"orders",
"products",
"customers"
] |
What are the different names, prices, and descriptions for all products bought by female customers?
|
SELECT DISTINCT T1.product_name , T1.product_price , T1.product_description FROM Products AS T1 JOIN Order_items AS T2 ON T1.product_id = T2.product_id JOIN Orders AS T3 ON T2.order_id = T3.order_id JOIN Customers AS T4 ON T3.customer_id = T4.customer_id WHERE T4.gender_code = 'Female'
|
extra
|
74 |
e_commerce
|
[
"shipments",
"invoices"
] |
What are invoices status of all the orders which have not been shipped?
|
SELECT invoice_status_code FROM Invoices WHERE invoice_number NOT IN ( SELECT invoice_number FROM Shipments )
|
hard
|
75 |
e_commerce
|
[
"shipments",
"invoices"
] |
What are the invoice statuses for all orderes that have not been shipped out yet?
|
SELECT invoice_status_code FROM Invoices WHERE invoice_number NOT IN ( SELECT invoice_number FROM Shipments )
|
hard
|
76 |
e_commerce
|
[
"orders",
"products",
"order_items"
] |
What are the total cost of all the orders ? List the order id , date , and total cost .
|
select t1.order_id , t1.date_order_placed , sum(t3.product_price) from orders as t1 join order_items as t2 on t1.order_id = t2.order_id join products as t3 on t2.product_id = t3.product_id group by t1.order_id
|
hard
|
77 |
e_commerce
|
[
"order_items",
"orders",
"products"
] |
For each order, what is its id, date, and total amount paid?
|
SELECT T1.order_id , T1.date_order_placed , sum(T3.product_price) FROM Orders AS T1 JOIN Order_items AS T2 ON T1.order_id = T2.order_id JOIN Products AS T3 ON T2.product_id = T3.product_id GROUP BY T1.order_id
|
hard
|
78 |
e_commerce
|
[
"orders"
] |
How many customers have placed any order?
|
SELECT count(DISTINCT customer_id) FROM Orders
|
easy
|
79 |
e_commerce
|
[
"orders"
] |
How many different customers have ordered things?
|
SELECT count(DISTINCT customer_id) FROM Orders
|
easy
|
80 |
e_commerce
|
[
"order_items"
] |
How many item states are there in the orders?
|
SELECT count(DISTINCT order_item_status_code) FROM Order_items
|
easy
|
81 |
e_commerce
|
[
"order_items"
] |
How many different item status codes are there listed in ordered items?
|
SELECT count(DISTINCT order_item_status_code) FROM Order_items
|
easy
|
82 |
e_commerce
|
[
"customer_payment_methods"
] |
How many different payment methods are there?
|
SELECT count(DISTINCT Payment_method_code) FROM Customer_Payment_Methods
|
easy
|
83 |
e_commerce
|
[
"customer_payment_methods"
] |
How many different payment methods can customers choose from?
|
SELECT count(DISTINCT Payment_method_code) FROM Customer_Payment_Methods
|
easy
|
84 |
e_commerce
|
[
"customers"
] |
What are the login names and passwords of the customers whose phone number have the prefix '+12'?
|
SELECT login_name , login_password FROM Customers WHERE phone_number LIKE '+12%'
|
medium
|
85 |
e_commerce
|
[
"customers"
] |
What are the usernames and passwords of all customers whose phone number starts with '+12'?
|
SELECT login_name , login_password FROM Customers WHERE phone_number LIKE '+12%'
|
medium
|
86 |
e_commerce
|
[
"products"
] |
What are the product sizes of the products whose name has the substring 'Dell'?
|
SELECT product_size FROM Products WHERE product_name LIKE '%Dell%'
|
medium
|
87 |
e_commerce
|
[
"products"
] |
What are the sizes of all products whose name includes the word 'Dell'?
|
SELECT product_size FROM Products WHERE product_name LIKE '%Dell%'
|
medium
|
88 |
e_commerce
|
[
"products"
] |
What are the product price and the product size of the products whose price is above average?
|
SELECT product_price , product_size FROM Products WHERE product_price > ( SELECT avg(product_price) FROM Products )
|
extra
|
89 |
e_commerce
|
[
"products"
] |
What are the prices and sizes of all products whose price is above the mean?
|
SELECT product_price , product_size FROM Products WHERE product_price > ( SELECT avg(product_price) FROM Products )
|
extra
|
90 |
e_commerce
|
[
"order_items",
"products"
] |
How many kinds of products have not been sold?
|
SELECT count(*) FROM Products WHERE product_id NOT IN ( SELECT product_id FROM Order_items )
|
extra
|
91 |
e_commerce
|
[
"order_items",
"products"
] |
What is the number of products that have not been ordered yet?
|
SELECT count(*) FROM Products WHERE product_id NOT IN ( SELECT product_id FROM Order_items )
|
extra
|
92 |
e_commerce
|
[
"customer_payment_methods",
"customers"
] |
How many customers do not have any payment method?
|
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payment_Methods )
|
extra
|
93 |
e_commerce
|
[
"customer_payment_methods",
"customers"
] |
How many customers do not have a listed payment method?
|
SELECT count(*) FROM Customers WHERE customer_id NOT IN ( SELECT customer_id FROM Customer_Payment_Methods )
|
extra
|
94 |
e_commerce
|
[
"orders"
] |
What are all the order status and all the dates of orders?
|
SELECT order_status_code , date_order_placed FROM Orders
|
medium
|
95 |
e_commerce
|
[
"orders"
] |
What are the status codes and dates placed for all of the orders?
|
SELECT order_status_code , date_order_placed FROM Orders
|
medium
|
96 |
e_commerce
|
[
"customers"
] |
List the address, town and county information of the customers who live in the USA.
|
SELECT address_line_1 , town_city , county FROM Customers WHERE Country = 'USA'
|
medium
|
97 |
e_commerce
|
[
"customers"
] |
What are the addresses, towns, and county information for all customers who live in the United States?
|
SELECT address_line_1 , town_city , county FROM Customers WHERE Country = 'USA'
|
medium
|
98 |
e_commerce
|
[
"order_items",
"orders",
"products",
"customers"
] |
List all the pairs of buyer first names and product names.
|
SELECT T1.customer_first_name , T4.product_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id
|
hard
|
99 |
e_commerce
|
[
"order_items",
"orders",
"products",
"customers"
] |
What are the first names of all buyers and what products did they buy? List them in pairs.
|
SELECT T1.customer_first_name , T4.product_name FROM Customers AS T1 JOIN Orders AS T2 ON T1.customer_id = T2.customer_id JOIN Order_items AS T3 ON T2.order_id = T3.order_id JOIN Products AS T4 ON T3.product_id = T4.product_id
|
hard
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.