db_id stringclasses 40
values | query stringlengths 22 608 | question stringlengths 22 185 |
|---|---|---|
bakery_1 | SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*) >= 15 | What are the customer ids of customers who have at least 15 receipts? |
bakery_1 | SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId = T2.id GROUP BY T2.id HAVING count(*) > 10 | What is the last name of the customers who shopped at the bakery more than 10 times? |
bakery_1 | SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId = T2.id GROUP BY T2.id HAVING count(*) > 10 | Give the last names of customers who have been to the bakery more than 10 times? |
bakery_1 | SELECT count(*) FROM goods WHERE food = "Cake" | How many types of Cake does this bakery sell? |
bakery_1 | SELECT count(*) FROM goods WHERE food = "Cake" | Count the number of types of cake this bakery sells. |
bakery_1 | SELECT flavor FROM goods WHERE food = "Croissant" | List all the flavors of Croissant available in this bakery. |
bakery_1 | SELECT flavor FROM goods WHERE food = "Croissant" | What are all the flavors of croissant? |
bakery_1 | SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt = T2.ReceiptNumber WHERE T2.CustomerId = 15 | Give me a list of all the distinct items bought by the customer number 15. |
bakery_1 | SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt = T2.ReceiptNumber WHERE T2.CustomerId = 15 | What are all the distinct items bought by customer 15? |
bakery_1 | SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food | For each type of food, what are the average, maximum and minimum price? |
bakery_1 | SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food | What are the average, minimum and maximum prices for each food? |
bakery_1 | 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" | Find the receipt numbers where both Cake and Cookie were bought. |
bakery_1 | 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" | What are the receipt numbers for instances where both cakes and cookies were purchased? |
bakery_1 | 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' | Find all the receipt numbers in which customer with last name LOGAN purchased Croissant. |
bakery_1 | 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' | What are the receipt numbers for a customer with the last name Logan who purchased a croissant? |
bakery_1 | 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 | What is the receipt number and date of the receipt in which the most expensive item was bought? |
bakery_1 | 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 | What is the receipt number and date corresponding to the receipt for which the most expensive item was purchased? |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1 | What is the item that was bought the least number of times? |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1 | Which item was bought the fewest times? |
bakery_1 | SELECT count(*) , food FROM goods GROUP BY food | How many goods are available for each food type? |
bakery_1 | SELECT count(*) , food FROM goods GROUP BY food | Count the number of goods for each food type. |
bakery_1 | SELECT avg(price) , food FROM goods GROUP BY food | What is the average price for each food type? |
bakery_1 | SELECT avg(price) , food FROM goods GROUP BY food | Give the average price for each food type. |
bakery_1 | SELECT id FROM goods WHERE flavor = "Apricot" AND price < 5 | What are ids of the goods that have Apricot flavor and are cheaper than 5 dollars? |
bakery_1 | SELECT id FROM goods WHERE flavor = "Apricot" AND price < 5 | Give the ids for goods that have Apricot flavor and have a price lower than 5 dollars. |
bakery_1 | SELECT flavor FROM goods WHERE food = "Cake" AND price > 10 | Find flavor of cakes that cost more than 10 dollars. |
bakery_1 | SELECT flavor FROM goods WHERE food = "Cake" AND price > 10 | What are the flavors of cakes that cost more than 10 dollars? |
bakery_1 | SELECT DISTINCT id , price FROM goods WHERE price < (SELECT avg(price) FROM goods) | Give me the distinct id and price for all goods whose price is below the average of all goods? |
bakery_1 | SELECT DISTINCT id , price FROM goods WHERE price < (SELECT avg(price) FROM goods) | What are the distinct ids and prices for goods that cost less than the average good? |
bakery_1 | SELECT DISTINCT id FROM goods WHERE price < (SELECT max(price) FROM goods WHERE food = "Tart") | What are the distinct ids of all goods that are cheaper than some goods of type Tart? |
bakery_1 | SELECT DISTINCT id FROM goods WHERE price < (SELECT max(price) FROM goods WHERE food = "Tart") | Give the distinct ids for goods that cost less than any Tart. |
bakery_1 | 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 | List distinct receipt numbers for which someone bought a good that costs more than 13 dollars. |
bakery_1 | 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 | What distinct receipt numbers correspond to someone who bought a good that costs more than 13 dollars? |
bakery_1 | 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 | On which date did some customer buy a good that costs more than 15 dollars? |
bakery_1 | 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 | Which date corresponds to when a customer purchased a good costing over 15 dollars? |
bakery_1 | SELECT id FROM goods WHERE id LIKE "%APP%" | Give me the list of ids of all goods whose id has "APP". |
bakery_1 | SELECT id FROM goods WHERE id LIKE "%APP%" | What are all the ids of goods with an id which contains "APP"? |
bakery_1 | SELECT id , price FROM goods WHERE id LIKE "%70%" | Which good has "70" in its id? And what is its price? |
bakery_1 | SELECT id , price FROM goods WHERE id LIKE "%70%" | What are the id and price for the good with "70" in its id? |
bakery_1 | SELECT DISTINCT LastName FROM customers ORDER BY LastName | List the last names of all customers in an alphabetical order. |
bakery_1 | SELECT DISTINCT LastName FROM customers ORDER BY LastName | What are the last names of the customers in alphabetical order? |
bakery_1 | SELECT DISTINCT id FROM goods ORDER BY id | Return the ordered list of all good ids. |
bakery_1 | SELECT DISTINCT id FROM goods ORDER BY id | Order the distinct good ids. |
bakery_1 | 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 | Find all receipts in which either apple flavor pie was bought or customer id 12 shopped. |
bakery_1 | 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 | What are the receipt numbers for which either an apple flavor pie was purchased or the customer with id 12 shopped? |
bakery_1 | SELECT ReceiptNumber , date FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date DESC LIMIT 1) | Find all receipts which has the latest date. Also tell me that date. |
bakery_1 | SELECT ReceiptNumber , date FROM receipts WHERE date = (SELECT date FROM receipts ORDER BY date DESC LIMIT 1) | What is the receipt number with the latest date, and what is that date? |
bakery_1 | 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) | Find all receipts which either has the earliest date or has a good with price above 10. |
bakery_1 | 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) | What are all the receipt numbers that have a good with a price above 10 or have the earliest date? |
bakery_1 | SELECT id FROM goods WHERE food = "Cookie" OR food = "Cake" AND price BETWEEN 3 AND 7 | What are the ids of Cookie and Cake that cost between 3 and 7 dollars. |
bakery_1 | SELECT id FROM goods WHERE food = "Cookie" OR food = "Cake" AND price BETWEEN 3 AND 7 | Give the ids of Cookies or Cakes that cost between 3 and 7 dollars. |
bakery_1 | SELECT T1.FirstName , T1.LastName FROM customers AS T1 JOIN receipts AS T2 ON T1.id = T2.CustomerId ORDER BY T2.date LIMIT 1 | Find the first name and last name of a customer who visited on the earliest date. |
bakery_1 | SELECT T1.FirstName , T1.LastName FROM customers AS T1 JOIN receipts AS T2 ON T1.id = T2.CustomerId ORDER BY T2.date LIMIT 1 | What is the full name of the customer who visited on the earliest date? |
bakery_1 | SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry" | What is average price of goods whose flavor is blackberry or blueberry? |
bakery_1 | SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry" | What are the average prices of goods with blackberry or blueberry flavor? |
bakery_1 | SELECT min(price) FROM goods WHERE flavor = "Cheese" | Return the cheapest price for goods with cheese flavor. |
bakery_1 | SELECT min(price) FROM goods WHERE flavor = "Cheese" | What is the cheapest good with cheese flavor? |
bakery_1 | SELECT max(price) , min(price) , avg(price) , flavor FROM goods GROUP BY flavor ORDER BY flavor | What are highest, lowest, and average prices of goods, grouped and ordered by flavor? |
bakery_1 | SELECT max(price) , min(price) , avg(price) , flavor FROM goods GROUP BY flavor ORDER BY flavor | What are the maximum, minimum, and average prices of goods of each flavor, ordered by flavor? |
bakery_1 | SELECT min(price) , max(price) , food FROM goods GROUP BY food ORDER BY food | Return the lowest and highest prices of goods grouped and ordered by food type. |
bakery_1 | SELECT min(price) , max(price) , food FROM goods GROUP BY food ORDER BY food | What are the minimum and maximum prices of food goods, ordered by food? |
bakery_1 | SELECT date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3 | Find the top three dates with the most receipts. |
bakery_1 | SELECT date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3 | What are the three dates for which the most receipts were given? |
bakery_1 | SELECT CustomerId , count(*) FROM receipts GROUP BY CustomerId ORDER BY count(*) DESC LIMIT 1 | Which customer shopped most often? How many times? |
bakery_1 | SELECT CustomerId , count(*) FROM receipts GROUP BY CustomerId ORDER BY count(*) DESC LIMIT 1 | Give the customer id of the customer that made the most purchases, as well as the number of purchases made. |
bakery_1 | SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date | For each date, return how many distinct customers visited on that day. |
bakery_1 | SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date | How many cusomters visited on each date? |
bakery_1 | 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" | Give me the first name and last name of customers who have bought apple flavor Tart. |
bakery_1 | 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" | What are the full names of customers who bought apple flavored Tarts? |
bakery_1 | SELECT id FROM goods WHERE food = "Cookie" AND price < (SELECT min(price) FROM goods WHERE food = 'Croissant') | What are the ids of Cookies whose price is lower than any Croissant? |
bakery_1 | SELECT id FROM goods WHERE food = "Cookie" AND price < (SELECT min(price) FROM goods WHERE food = 'Croissant') | Give the ids of cookes that are cheaper than any croissant. |
bakery_1 | SELECT id FROM goods WHERE food = "Cake" AND price >= (SELECT avg(price) FROM goods WHERE food = "Tart") | Give me the ids of Cakes whose price is at least as much as the average price of Tart? |
bakery_1 | SELECT id FROM goods WHERE food = "Cake" AND price >= (SELECT avg(price) FROM goods WHERE food = "Tart") | What are the ids of cakes that are at least as expensive as the average Tart? |
bakery_1 | SELECT id FROM goods WHERE price > (SELECT avg(price) FROM goods) | What are the ids of goods whose price is above twice the average price of all goods? |
bakery_1 | SELECT id FROM goods WHERE price > (SELECT avg(price) FROM goods) | Give the ids of goods that are more than twice as expensive as the average good. |
bakery_1 | SELECT id , flavor , food FROM goods ORDER BY price | List the id, flavor and type of food of goods ordered by price. |
bakery_1 | SELECT id , flavor , food FROM goods ORDER BY price | What are the ids, flavors, and food types of goods, ordered by price? |
bakery_1 | SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor | Return a list of the id and flavor for Cakes ordered by flavor. |
bakery_1 | SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor | What are the ids and flavors of cakes, ordered by flavor? |
bakery_1 | 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 | Find all the items that have chocolate flavor but were not bought more than 10 times. |
bakery_1 | 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 | What are the items with chocolate flavor that were purchased at most 10 times. |
bakery_1 | SELECT DISTINCT flavor FROM goods WHERE food = "Cake" EXCEPT SELECT DISTINCT flavor FROM goods WHERE food = "Tart" | What are the flavors available for Cake but not for Tart? |
bakery_1 | SELECT DISTINCT flavor FROM goods WHERE food = "Cake" EXCEPT SELECT DISTINCT flavor FROM goods WHERE food = "Tart" | Give the flavors of Cakes that are not available for Tart. |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3 | What is the three most popular goods in this bakery? |
bakery_1 | SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3 | Give the three most purchased items at this bakery. |
bakery_1 | 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 | Find the ids of customers who have spent more than 150 dollars in total. |
bakery_1 | 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 | What are the ids of customers who have spent over 150 dollars in total? |
bakery_1 | 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 | Find the ids of customers whose average spending for each good is above 5. |
bakery_1 | 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 | What are the ids of customers who spend more than 5 on average for each good? |
bakery_1 | 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 | On which day did the bakery sell more than 100 dollars in total. |
bakery_1 | 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 | On what dates did the bakery sell more than 100 dollars worth of goods in total? |
car_racing | SELECT count(*) FROM driver | How many drivers are there? |
car_racing | SELECT count(*) FROM driver | Find the total number of drivers. |
car_racing | SELECT make , count(*) FROM driver WHERE points > 150 GROUP BY make | Find the number of drivers whose points are greater than 150 for each make. |
car_racing | SELECT make , count(*) FROM driver WHERE points > 150 GROUP BY make | How many drivers receive points greater than 150 for each make? Show the make and the count. |
car_racing | SELECT avg(age) , Make FROM driver GROUP BY make | Find the average age of drivers for each make. |
car_racing | SELECT avg(age) , Make FROM driver GROUP BY make | What is the average age of drivers for each make? Return the average age and make. |
car_racing | SELECT avg(Laps) FROM driver WHERE age < 20 | What are the average laps of all the drivers who are younger than 20? |
car_racing | SELECT avg(Laps) FROM driver WHERE age < 20 | Compute the average laps of drivers under the age of 20. |
car_racing | SELECT Manager , Sponsor FROM team ORDER BY Car_Owner | What are the managers and sponsors of teams? Sort the results by Car Owners. |
Subsets and Splits
World Countries Non-English Languages
The query filters specific database entries based on a particular query pattern, providing limited insight as it simply retrieves rows that match a specific condition.