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 |
---|---|---|---|---|---|
1,500 |
bakery_1
|
[
"receipts"
] |
What are the customer ids of customers who have at least 15 receipts?
|
SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*) >= 15
|
easy
|
1,501 |
bakery_1
|
[
"receipts",
"customers"
] |
What is the last name of the customers who shopped at the bakery more than 10 times?
|
SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId = T2.id GROUP BY T2.id HAVING count(*) > 10
|
medium
|
1,502 |
bakery_1
|
[
"receipts",
"customers"
] |
Give the last names of customers who have been to the bakery more than 10 times?
|
SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId = T2.id GROUP BY T2.id HAVING count(*) > 10
|
medium
|
1,503 |
bakery_1
|
[
"goods"
] |
How many types of Cake does this bakery sell?
|
SELECT count(*) FROM goods WHERE food = "Cake"
|
easy
|
1,504 |
bakery_1
|
[
"goods"
] |
Count the number of types of cake this bakery sells.
|
SELECT count(*) FROM goods WHERE food = "Cake"
|
easy
|
1,505 |
bakery_1
|
[
"goods"
] |
List all the flavors of Croissant available in this bakery.
|
SELECT flavor FROM goods WHERE food = "Croissant"
|
easy
|
1,506 |
bakery_1
|
[
"goods"
] |
What are all the flavors of croissant?
|
SELECT flavor FROM goods WHERE food = "Croissant"
|
easy
|
1,507 |
bakery_1
|
[
"receipts",
"items"
] |
Give me a list of all the distinct items bought by the customer number 15.
|
SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt = T2.ReceiptNumber WHERE T2.CustomerId = 15
|
medium
|
1,508 |
bakery_1
|
[
"receipts",
"items"
] |
What are all the distinct items bought by customer 15?
|
SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt = T2.ReceiptNumber WHERE T2.CustomerId = 15
|
medium
|
1,509 |
bakery_1
|
[
"goods"
] |
For each type of food, what are the average, maximum and minimum price?
|
SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food
|
medium
|
1,510 |
bakery_1
|
[
"goods"
] |
What are the average, minimum and maximum prices for each food?
|
SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food
|
medium
|
1,511 |
bakery_1
|
[
"items",
"goods"
] |
Find the receipt numbers where both Cake and Cookie were bought.
|
SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.food = "Cake" INTERSECT SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.food = "Cookie"
|
extra
|
1,512 |
bakery_1
|
[
"items",
"goods"
] |
What are the receipt numbers for instances where both cakes and cookies were purchased?
|
SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.food = "Cake" INTERSECT SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.food = "Cookie"
|
extra
|
1,513 |
bakery_1
|
[
"receipts",
"customers",
"items",
"goods"
] |
Find all the receipt numbers in which customer with last name LOGAN purchased Croissant.
|
SELECT T1.ReceiptNumber FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id JOIN customers AS T4 ON T4.Id = T1.CustomerId WHERE T3.food = "Croissant" AND T4.LastName = 'LOGAN'
|
extra
|
1,514 |
bakery_1
|
[
"receipts",
"customers",
"items",
"goods"
] |
What are the receipt numbers for a customer with the last name Logan who purchased a croissant?
|
SELECT T1.ReceiptNumber FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id JOIN customers AS T4 ON T4.Id = T1.CustomerId WHERE T3.food = "Croissant" AND T4.LastName = 'LOGAN'
|
extra
|
1,515 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What is the receipt number and date of the receipt in which the most expensive item was bought?
|
SELECT T1.ReceiptNumber , T1.Date FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id ORDER BY T3.price DESC LIMIT 1
|
extra
|
1,516 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What is the receipt number and date corresponding to the receipt for which the most expensive item was purchased?
|
SELECT T1.ReceiptNumber , T1.Date FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id ORDER BY T3.price DESC LIMIT 1
|
extra
|
1,517 |
bakery_1
|
[
"items"
] |
What is the item that was bought the least number of times?
|
SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1
|
hard
|
1,518 |
bakery_1
|
[
"items"
] |
Which item was bought the fewest times?
|
SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1
|
hard
|
1,519 |
bakery_1
|
[
"goods"
] |
How many goods are available for each food type?
|
SELECT count(*) , food FROM goods GROUP BY food
|
medium
|
1,520 |
bakery_1
|
[
"goods"
] |
Count the number of goods for each food type.
|
SELECT count(*) , food FROM goods GROUP BY food
|
medium
|
1,521 |
bakery_1
|
[
"goods"
] |
What is the average price for each food type?
|
SELECT avg(price) , food FROM goods GROUP BY food
|
medium
|
1,522 |
bakery_1
|
[
"goods"
] |
Give the average price for each food type.
|
SELECT avg(price) , food FROM goods GROUP BY food
|
medium
|
1,523 |
bakery_1
|
[
"goods"
] |
What are ids of the goods that have Apricot flavor and are cheaper than 5 dollars?
|
SELECT id FROM goods WHERE flavor = "Apricot" AND price < 5
|
medium
|
1,524 |
bakery_1
|
[
"goods"
] |
Give the ids for goods that have Apricot flavor and have a price lower than 5 dollars.
|
SELECT id FROM goods WHERE flavor = "Apricot" AND price < 5
|
medium
|
1,525 |
bakery_1
|
[
"goods"
] |
Find flavor of cakes that cost more than 10 dollars.
|
SELECT flavor FROM goods WHERE food = "Cake" AND price > 10
|
medium
|
1,526 |
bakery_1
|
[
"goods"
] |
What are the flavors of cakes that cost more than 10 dollars?
|
SELECT flavor FROM goods WHERE food = "Cake" AND price > 10
|
medium
|
1,527 |
bakery_1
|
[
"goods"
] |
Give me the distinct id and price for all goods whose price is below the average of all goods?
|
SELECT DISTINCT id , price FROM goods WHERE price < (SELECT avg(price) FROM goods)
|
extra
|
1,528 |
bakery_1
|
[
"goods"
] |
What are the distinct ids and prices for goods that cost less than the average good?
|
SELECT DISTINCT id , price FROM goods WHERE price < (SELECT avg(price) FROM goods)
|
extra
|
1,529 |
bakery_1
|
[
"goods"
] |
What are the distinct ids of all goods that are cheaper than some goods of type Tart?
|
SELECT DISTINCT id FROM goods WHERE price < (SELECT max(price) FROM goods WHERE food = "Tart")
|
hard
|
1,530 |
bakery_1
|
[
"goods"
] |
Give the distinct ids for goods that cost less than any Tart.
|
SELECT DISTINCT id FROM goods WHERE price < (SELECT max(price) FROM goods WHERE food = "Tart")
|
hard
|
1,531 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
List distinct receipt numbers for which someone bought a good that costs more than 13 dollars.
|
SELECT DISTINCT T1.ReceiptNumber FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id WHERE T3.price > 13
|
hard
|
1,532 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What distinct receipt numbers correspond to someone who bought a good that costs more than 13 dollars?
|
SELECT DISTINCT T1.ReceiptNumber FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id WHERE T3.price > 13
|
hard
|
1,533 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
On which date did some customer buy a good that costs more than 15 dollars?
|
SELECT DISTINCT T1.date FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id WHERE T3.price > 15
|
hard
|
1,534 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
Which date corresponds to when a customer purchased a good costing over 15 dollars?
|
SELECT DISTINCT T1.date FROM receipts AS T1 JOIN items AS T2 ON T1.ReceiptNumber = T2.receipt JOIN goods AS T3 ON T2.item = T3.id WHERE T3.price > 15
|
hard
|
1,535 |
bakery_1
|
[
"goods"
] |
Give me the list of ids of all goods whose id has "APP".
|
SELECT id FROM goods WHERE id LIKE "%APP%"
|
medium
|
1,536 |
bakery_1
|
[
"goods"
] |
What are all the ids of goods with an id which contains "APP"?
|
SELECT id FROM goods WHERE id LIKE "%APP%"
|
medium
|
1,537 |
bakery_1
|
[
"goods"
] |
Which good has "70" in its id? And what is its price?
|
SELECT id , price FROM goods WHERE id LIKE "%70%"
|
medium
|
1,538 |
bakery_1
|
[
"goods"
] |
What are the id and price for the good with "70" in its id?
|
SELECT id , price FROM goods WHERE id LIKE "%70%"
|
medium
|
1,539 |
bakery_1
|
[
"customers"
] |
List the last names of all customers in an alphabetical order.
|
SELECT DISTINCT LastName FROM customers ORDER BY LastName
|
easy
|
1,540 |
bakery_1
|
[
"customers"
] |
What are the last names of the customers in alphabetical order?
|
SELECT DISTINCT LastName FROM customers ORDER BY LastName
|
easy
|
1,541 |
bakery_1
|
[
"goods"
] |
Return the ordered list of all good ids.
|
SELECT DISTINCT id FROM goods ORDER BY id
|
easy
|
1,542 |
bakery_1
|
[
"goods"
] |
Order the distinct good ids.
|
SELECT DISTINCT id FROM goods ORDER BY id
|
easy
|
1,543 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
Find all receipts in which either apple flavor pie was bought or customer id 12 shopped.
|
SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.flavor = "Apple" AND T2.food = "Pie" UNION SELECT ReceiptNumber FROM receipts WHERE CustomerId = 12
|
extra
|
1,544 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What are the receipt numbers for which either an apple flavor pie was purchased or the customer with id 12 shopped?
|
SELECT T1.receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.flavor = "Apple" AND T2.food = "Pie" UNION SELECT ReceiptNumber FROM receipts WHERE CustomerId = 12
|
extra
|
1,545 |
bakery_1
|
[
"receipts"
] |
Find all receipts which has the latest date. Also tell me that date.
|
SELECT ReceiptNumber , date FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date DESC LIMIT 1)
|
extra
|
1,546 |
bakery_1
|
[
"receipts"
] |
What is the receipt number with the latest date, and what is that date?
|
SELECT ReceiptNumber , date FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date DESC LIMIT 1)
|
extra
|
1,547 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
Find all receipts which either has the earliest date or has a good with price above 10.
|
SELECT T1.Receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.price > 10 UNION SELECT ReceiptNumber FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date LIMIT 1)
|
extra
|
1,548 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What are all the receipt numbers that have a good with a price above 10 or have the earliest date?
|
SELECT T1.Receipt FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.price > 10 UNION SELECT ReceiptNumber FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date LIMIT 1)
|
extra
|
1,549 |
bakery_1
|
[
"goods"
] |
What are the ids of Cookie and Cake that cost between 3 and 7 dollars.
|
SELECT id FROM goods WHERE food = "Cookie" OR food = "Cake" AND price BETWEEN 3 AND 7
|
medium
|
1,550 |
bakery_1
|
[
"goods"
] |
Give the ids of Cookies or Cakes that cost between 3 and 7 dollars.
|
SELECT id FROM goods WHERE food = "Cookie" OR food = "Cake" AND price BETWEEN 3 AND 7
|
medium
|
1,551 |
bakery_1
|
[
"receipts",
"customers"
] |
Find the first name and last name of a customer who visited on the earliest date.
|
SELECT T1.FirstName , T1.LastName FROM customers AS T1 JOIN receipts AS T2 ON T1.id = T2.CustomerId ORDER BY T2.date LIMIT 1
|
hard
|
1,552 |
bakery_1
|
[
"receipts",
"customers"
] |
What is the full name of the customer who visited on the earliest date?
|
SELECT T1.FirstName , T1.LastName FROM customers AS T1 JOIN receipts AS T2 ON T1.id = T2.CustomerId ORDER BY T2.date LIMIT 1
|
hard
|
1,553 |
bakery_1
|
[
"goods"
] |
What is average price of goods whose flavor is blackberry or blueberry?
|
SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry"
|
medium
|
1,554 |
bakery_1
|
[
"goods"
] |
What are the average prices of goods with blackberry or blueberry flavor?
|
SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry"
|
medium
|
1,555 |
bakery_1
|
[
"goods"
] |
Return the cheapest price for goods with cheese flavor.
|
SELECT min(price) FROM goods WHERE flavor = "Cheese"
|
easy
|
1,556 |
bakery_1
|
[
"goods"
] |
What is the cheapest good with cheese flavor?
|
SELECT min(price) FROM goods WHERE flavor = "Cheese"
|
easy
|
1,557 |
bakery_1
|
[
"goods"
] |
What are highest, lowest, and average prices of goods, grouped and ordered by flavor?
|
SELECT max(price) , min(price) , avg(price) , flavor FROM goods GROUP BY flavor ORDER BY flavor
|
extra
|
1,558 |
bakery_1
|
[
"goods"
] |
What are the maximum, minimum, and average prices of goods of each flavor, ordered by flavor?
|
SELECT max(price) , min(price) , avg(price) , flavor FROM goods GROUP BY flavor ORDER BY flavor
|
extra
|
1,559 |
bakery_1
|
[
"goods"
] |
Return the lowest and highest prices of goods grouped and ordered by food type.
|
SELECT min(price) , max(price) , food FROM goods GROUP BY food ORDER BY food
|
extra
|
1,560 |
bakery_1
|
[
"goods"
] |
What are the minimum and maximum prices of food goods, ordered by food?
|
SELECT min(price) , max(price) , food FROM goods GROUP BY food ORDER BY food
|
extra
|
1,561 |
bakery_1
|
[
"receipts"
] |
Find the top three dates with the most receipts.
|
SELECT date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3
|
hard
|
1,562 |
bakery_1
|
[
"receipts"
] |
What are the three dates for which the most receipts were given?
|
SELECT date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3
|
hard
|
1,563 |
bakery_1
|
[
"receipts"
] |
Which customer shopped most often? How many times?
|
SELECT CustomerId , count(*) FROM receipts GROUP BY CustomerId ORDER BY count(*) DESC LIMIT 1
|
hard
|
1,564 |
bakery_1
|
[
"receipts"
] |
Give the customer id of the customer that made the most purchases, as well as the number of purchases made.
|
SELECT CustomerId , count(*) FROM receipts GROUP BY CustomerId ORDER BY count(*) DESC LIMIT 1
|
hard
|
1,565 |
bakery_1
|
[
"receipts"
] |
For each date, return how many distinct customers visited on that day.
|
SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date
|
medium
|
1,566 |
bakery_1
|
[
"receipts"
] |
How many cusomters visited on each date?
|
SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date
|
medium
|
1,567 |
bakery_1
|
[
"receipts",
"customers",
"items",
"goods"
] |
Give me the first name and last name of customers who have bought apple flavor Tart.
|
SELECT DISTINCT T4.FirstName , T4.LastName FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber JOIN customers AS T4 ON T3.CustomerId = T4.id WHERE T1.flavor = "Apple" AND T1.food = "Tart"
|
extra
|
1,568 |
bakery_1
|
[
"receipts",
"customers",
"items",
"goods"
] |
What are the full names of customers who bought apple flavored Tarts?
|
SELECT DISTINCT T4.FirstName , T4.LastName FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber JOIN customers AS T4 ON T3.CustomerId = T4.id WHERE T1.flavor = "Apple" AND T1.food = "Tart"
|
extra
|
1,569 |
bakery_1
|
[
"goods"
] |
What are the ids of Cookies whose price is lower than any Croissant?
|
SELECT id FROM goods WHERE food = "Cookie" AND price < (SELECT min(price) FROM goods WHERE food = 'Croissant')
|
extra
|
1,570 |
bakery_1
|
[
"goods"
] |
Give the ids of cookes that are cheaper than any croissant.
|
SELECT id FROM goods WHERE food = "Cookie" AND price < (SELECT min(price) FROM goods WHERE food = 'Croissant')
|
extra
|
1,571 |
bakery_1
|
[
"goods"
] |
Give me the ids of Cakes whose price is at least as much as the average price of Tart?
|
SELECT id FROM goods WHERE food = "Cake" AND price >= (SELECT avg(price) FROM goods WHERE food = "Tart")
|
extra
|
1,572 |
bakery_1
|
[
"goods"
] |
What are the ids of cakes that are at least as expensive as the average Tart?
|
SELECT id FROM goods WHERE food = "Cake" AND price >= (SELECT avg(price) FROM goods WHERE food = "Tart")
|
extra
|
1,573 |
bakery_1
|
[
"goods"
] |
What are the ids of goods whose price is above twice the average price of all goods?
|
SELECT id FROM goods WHERE price > (SELECT avg(price) FROM goods)
|
hard
|
1,574 |
bakery_1
|
[
"goods"
] |
Give the ids of goods that are more than twice as expensive as the average good.
|
SELECT id FROM goods WHERE price > (SELECT avg(price) FROM goods)
|
hard
|
1,575 |
bakery_1
|
[
"goods"
] |
List the id, flavor and type of food of goods ordered by price.
|
SELECT id , flavor , food FROM goods ORDER BY price
|
medium
|
1,576 |
bakery_1
|
[
"goods"
] |
What are the ids, flavors, and food types of goods, ordered by price?
|
SELECT id , flavor , food FROM goods ORDER BY price
|
medium
|
1,577 |
bakery_1
|
[
"goods"
] |
Return a list of the id and flavor for Cakes ordered by flavor.
|
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor
|
medium
|
1,578 |
bakery_1
|
[
"goods"
] |
What are the ids and flavors of cakes, ordered by flavor?
|
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor
|
medium
|
1,579 |
bakery_1
|
[
"items",
"goods"
] |
Find all the items that have chocolate flavor but were not bought more than 10 times.
|
SELECT DISTINCT T1.item FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.flavor = "Chocolate" GROUP BY item HAVING count(*) <= 10
|
hard
|
1,580 |
bakery_1
|
[
"items",
"goods"
] |
What are the items with chocolate flavor that were purchased at most 10 times.
|
SELECT DISTINCT T1.item FROM items AS T1 JOIN goods AS T2 ON T1.item = T2.id WHERE T2.flavor = "Chocolate" GROUP BY item HAVING count(*) <= 10
|
hard
|
1,581 |
bakery_1
|
[
"goods"
] |
What are the flavors available for Cake but not for Tart?
|
SELECT DISTINCT flavor FROM goods WHERE food = "Cake" EXCEPT SELECT DISTINCT flavor FROM goods WHERE food = "Tart"
|
hard
|
1,582 |
bakery_1
|
[
"goods"
] |
Give the flavors of Cakes that are not available for Tart.
|
SELECT DISTINCT flavor FROM goods WHERE food = "Cake" EXCEPT SELECT DISTINCT flavor FROM goods WHERE food = "Tart"
|
hard
|
1,583 |
bakery_1
|
[
"items"
] |
What is the three most popular goods in this bakery?
|
SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3
|
hard
|
1,584 |
bakery_1
|
[
"items"
] |
Give the three most purchased items at this bakery.
|
SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3
|
hard
|
1,585 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
Find the ids of customers who have spent more than 150 dollars in total.
|
SELECT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.CustomerId HAVING sum(T1.price) > 150
|
hard
|
1,586 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What are the ids of customers who have spent over 150 dollars in total?
|
SELECT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.CustomerId HAVING sum(T1.price) > 150
|
hard
|
1,587 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
Find the ids of customers whose average spending for each good is above 5.
|
SELECT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.CustomerId HAVING avg(T1.price) > 5
|
hard
|
1,588 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
What are the ids of customers who spend more than 5 on average for each good?
|
SELECT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.CustomerId HAVING avg(T1.price) > 5
|
hard
|
1,589 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
On which day did the bakery sell more than 100 dollars in total.
|
SELECT T3.date FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.date HAVING sum(T1.price) > 100
|
hard
|
1,590 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
On what dates did the bakery sell more than 100 dollars worth of goods in total?
|
SELECT T3.date FROM goods AS T1 JOIN items AS T2 ON T1.id = T2.item JOIN receipts AS T3 ON T2.receipt = T3.ReceiptNumber GROUP BY T3.date HAVING sum(T1.price) > 100
|
hard
|
1,591 |
car_racing
|
[
"driver"
] |
How many drivers are there?
|
SELECT count(*) FROM driver
|
easy
|
1,592 |
car_racing
|
[
"driver"
] |
Find the total number of drivers.
|
SELECT count(*) FROM driver
|
easy
|
1,593 |
car_racing
|
[
"driver"
] |
Find the number of drivers whose points are greater than 150 for each make.
|
SELECT make , count(*) FROM driver WHERE points > 150 GROUP BY make
|
medium
|
1,594 |
car_racing
|
[
"driver"
] |
How many drivers receive points greater than 150 for each make? Show the make and the count.
|
SELECT make , count(*) FROM driver WHERE points > 150 GROUP BY make
|
medium
|
1,595 |
car_racing
|
[
"driver"
] |
Find the average age of drivers for each make.
|
SELECT avg(age) , Make FROM driver GROUP BY make
|
medium
|
1,596 |
car_racing
|
[
"driver"
] |
What is the average age of drivers for each make? Return the average age and make.
|
SELECT avg(age) , Make FROM driver GROUP BY make
|
medium
|
1,597 |
car_racing
|
[
"driver"
] |
What are the average laps of all the drivers who are younger than 20?
|
SELECT avg(Laps) FROM driver WHERE age < 20
|
easy
|
1,598 |
car_racing
|
[
"driver"
] |
Compute the average laps of drivers under the age of 20.
|
SELECT avg(Laps) FROM driver WHERE age < 20
|
easy
|
1,599 |
car_racing
|
[
"team"
] |
What are the managers and sponsors of teams? Sort the results by Car Owners.
|
SELECT Manager , Sponsor FROM team ORDER BY Car_Owner
|
medium
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.