nl stringlengths 22 185 | sql stringlengths 22 608 | db_id stringclasses 40
values | table_schema stringclasses 305
values |
|---|---|---|---|
What are the customer ids of customers who have at least 15 receipts? | SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*) >= 15 | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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 | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_colum... |
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 | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_colum... |
How many types of Cake does this bakery sell? | SELECT count(*) FROM goods WHERE food = "Cake" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Count the number of types of cake this bakery sells. | SELECT count(*) FROM goods WHERE food = "Cake" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
List all the flavors of Croissant available in this bakery. | SELECT flavor FROM goods WHERE food = "Croissant" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are all the flavors of croissant? | SELECT flavor FROM goods WHERE food = "Croissant" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_c... |
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 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_c... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the average, minimum and maximum prices for each food? | SELECT food , avg(price) , max(price) , min(price) FROM goods GROUP BY food | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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' | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_co... |
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' | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_co... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
What is the item that was bought the least number of times? | SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}] |
Which item was bought the fewest times? | SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}] |
How many goods are available for each food type? | SELECT count(*) , food FROM goods GROUP BY food | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Count the number of goods for each food type. | SELECT count(*) , food FROM goods GROUP BY food | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What is the average price for each food type? | SELECT avg(price) , food FROM goods GROUP BY food | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Give the average price for each food type. | SELECT avg(price) , food FROM goods GROUP BY food | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Find flavor of cakes that cost more than 10 dollars. | SELECT flavor FROM goods WHERE food = "Cake" AND price > 10 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the flavors of cakes that cost more than 10 dollars? | SELECT flavor FROM goods WHERE food = "Cake" AND price > 10 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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") | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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") | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
Give me the list of ids of all goods whose id has "APP". | SELECT id FROM goods WHERE id LIKE "%APP%" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are all the ids of goods with an id which contains "APP"? | SELECT id FROM goods WHERE id LIKE "%APP%" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Which good has "70" in its id? And what is its price? | SELECT id , price FROM goods WHERE id LIKE "%70%" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the id and price for the good with "70" in its id? | SELECT id , price FROM goods WHERE id LIKE "%70%" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
List the last names of all customers in an alphabetical order. | SELECT DISTINCT LastName FROM customers ORDER BY LastName | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the last names of the customers in alphabetical order? | SELECT DISTINCT LastName FROM customers ORDER BY LastName | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Return the ordered list of all good ids. | SELECT DISTINCT id FROM goods ORDER BY id | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Order the distinct good ids. | SELECT DISTINCT id FROM goods ORDER BY id | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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) | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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) | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_colum... |
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 | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_colum... |
What is average price of goods whose flavor is blackberry or blueberry? | SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the average prices of goods with blackberry or blueberry flavor? | SELECT avg(price) FROM goods WHERE flavor = "Blackberry" OR flavor = "Blueberry" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Return the cheapest price for goods with cheese flavor. | SELECT min(price) FROM goods WHERE flavor = "Cheese" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What is the cheapest good with cheese flavor? | SELECT min(price) FROM goods WHERE flavor = "Cheese" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Find the top three dates with the most receipts. | SELECT date FROM receipts GROUP BY date ORDER BY count(*) DESC LIMIT 3 | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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 | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
Which customer shopped most often? How many times? | SELECT CustomerId , count(*) FROM receipts GROUP BY CustomerId ORDER BY count(*) DESC LIMIT 1 | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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 | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
For each date, return how many distinct customers visited on that day. | SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
How many cusomters visited on each date? | SELECT date , COUNT (DISTINCT CustomerId) FROM receipts GROUP BY date | bakery_1 | [{'table_name': 'receipts', 'table_schema': [{'col_name': 'receipt number'}, {'col_name': 'date'}, {'col_name': 'customer id'}], 'foreign_key_columns': ['customer id'], 'primary_keys': ['receipt number']}] |
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" | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_co... |
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" | bakery_1 | [{'table_name': 'customers', 'table_schema': [{'col_name': 'id'}, {'col_name': 'last name'}, {'col_name': 'first name'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_co... |
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') | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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') | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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") | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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") | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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) | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
List the id, flavor and type of food of goods ordered by price. | SELECT id , flavor , food FROM goods ORDER BY price | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the ids, flavors, and food types of goods, ordered by price? | SELECT id , flavor , food FROM goods ORDER BY price | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
Return a list of the id and flavor for Cakes ordered by flavor. | SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What are the ids and flavors of cakes, ordered by flavor? | SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY flavor | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
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" | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}] |
What is the three most popular goods in this bakery? | SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}] |
Give the three most purchased items at this bakery. | SELECT item FROM items GROUP BY item ORDER BY COUNT (*) DESC LIMIT 3 | bakery_1 | [{'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns': ['item'], 'primary_keys': ['receipt']}] |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
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 | bakery_1 | [{'table_name': 'goods', 'table_schema': [{'col_name': 'id'}, {'col_name': 'flavor'}, {'col_name': 'food'}, {'col_name': 'price'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'items', 'table_schema': [{'col_name': 'receipt'}, {'col_name': 'ordinal'}, {'col_name': 'item'}], 'foreign_key_columns':... |
How many drivers are there? | SELECT count(*) FROM driver | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
Find the total number of drivers. | SELECT count(*) FROM driver | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
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 | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
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 | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
Find the average age of drivers for each make. | SELECT avg(age) , Make FROM driver GROUP BY make | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
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 | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
What are the average laps of all the drivers who are younger than 20? | SELECT avg(Laps) FROM driver WHERE age < 20 | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
Compute the average laps of drivers under the age of 20. | SELECT avg(Laps) FROM driver WHERE age < 20 | car_racing | [{'table_name': 'driver', 'table_schema': [{'col_name': 'driver id'}, {'col_name': 'driver'}, {'col_name': 'country'}, {'col_name': 'age'}, {'col_name': 'car #'}, {'col_name': 'make'}, {'col_name': 'points'}, {'col_name': 'laps'}, {'col_name': 'winnings'}], 'foreign_key_columns': [], 'primary_keys': ['driver id']}] |
What are the managers and sponsors of teams? Sort the results by Car Owners. | SELECT Manager , Sponsor FROM team ORDER BY Car_Owner | car_racing | [{'table_name': 'team', 'table_schema': [{'col_name': 'team id'}, {'col_name': 'team'}, {'col_name': 'make'}, {'col_name': 'manager'}, {'col_name': 'sponsor'}, {'col_name': 'car owner'}], 'foreign_key_columns': [], 'primary_keys': ['team id']}] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.