target-benchmark/spider-queries huggingface dataset:
Database: real_estate_rentals (tables: addresses, properties)
Question: What are the zip codes of properties which do not belong to users who own at most 2 properties?
SQL: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Properties AS T2 ON T1.address_id  =  T2.property_address_id WHERE T2.owner_user_id NOT IN ( SELECT owner_user_id FROM Properties GROUP BY owner_user_id HAVING count(*)  <=  2 );
Database: real_estate_rentals (tables: addresses, properties)
Question: Return the zip codes for properties not belonging to users who own two or fewer properties.
SQL: SELECT T1.zip_postcode FROM Addresses AS T1 JOIN Properties AS T2 ON T1.address_id  =  T2.property_address_id WHERE T2.owner_user_id NOT IN ( SELECT owner_user_id FROM Properties GROUP BY owner_user_id HAVING count(*)  <=  2 );
Database: real_estate_rentals (tables: users, user_searches)
Question: What are the users making only one search? List both category and user id.
SQL: SELECT T1.user_category_code ,  T1.user_id FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id GROUP BY T1.user_id HAVING count(*)  =  1;
Database: real_estate_rentals (tables: users, user_searches)
Question: What are the ids of users who have only made one search, and what are their category codes?
SQL: SELECT T1.user_category_code ,  T1.user_id FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id GROUP BY T1.user_id HAVING count(*)  =  1;
Database: real_estate_rentals (tables: users, user_searches)
Question: What is the age range category of the user who made the first search?
SQL: SELECT T1.age_category_code FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id ORDER BY T2.search_datetime LIMIT 1;
Database: real_estate_rentals (tables: users, user_searches)
Question: Return the age category for the user who made the earliest search.
SQL: SELECT T1.age_category_code FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id ORDER BY T2.search_datetime LIMIT 1;
Database: real_estate_rentals (tables: users)
Question: Find the login names of all senior citizen users ordered by their first names.
SQL: SELECT login_name FROM Users WHERE user_category_code  =  'Senior Citizen' ORDER BY first_name
Database: real_estate_rentals (tables: users)
Question: What are the login names of all senior citizens, sorted by first name?
SQL: SELECT login_name FROM Users WHERE user_category_code  =  'Senior Citizen' ORDER BY first_name
Database: real_estate_rentals (tables: users, user_searches)
Question: How many searches do buyers make in total?
SQL: SELECT count(*) FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id WHERE T1.is_buyer  =  1;
Database: real_estate_rentals (tables: users, user_searches)
Question: Count the number of searches made by buyers.
SQL: SELECT count(*) FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id WHERE T1.is_buyer  =  1;
Database: real_estate_rentals (tables: users)
Question: When did the user with login name ratione register?
SQL: SELECT date_registered FROM Users WHERE login_name  =  'ratione';
Database: real_estate_rentals (tables: users)
Question: What was the registration date for the user whose login name is ratione?
SQL: SELECT date_registered FROM Users WHERE login_name  =  'ratione';
Database: real_estate_rentals (tables: users)
Question: List the first name, middle name and last name, and log in name of all the seller users, whose seller value is 1.
SQL: SELECT first_name ,  middle_name ,  last_name ,  login_name FROM Users WHERE is_seller  =  1;
Database: real_estate_rentals (tables: users)
Question: What are the first, middle, last, and login names for all users who are sellers?
SQL: SELECT first_name ,  middle_name ,  last_name ,  login_name FROM Users WHERE is_seller  =  1;
Database: real_estate_rentals (tables: users, addresses)
Question: Where do the Senior Citizens live? List building, street, and the city.
SQL: SELECT T1.line_1_number_building ,  T1.line_2_number_street ,  T1.town_city FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.user_category_code  =  'Senior Citizen';
Database: real_estate_rentals (tables: users, addresses)
Question: What are the buildings, streets, and cities corresponding to the addresses of senior citizens?
SQL: SELECT T1.line_1_number_building ,  T1.line_2_number_street ,  T1.town_city FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.user_category_code  =  'Senior Citizen';
Database: real_estate_rentals (tables: properties)
Question: How many properties are there with at least 2 features?
SQL: SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*)  >= 2;
Database: real_estate_rentals (tables: properties)
Question: Count the number of properties with at least two features.
SQL: SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*)  >= 2;
Database: real_estate_rentals (tables: property_photos)
Question: How many photos does each property have?
SQL: SELECT count(*) ,  property_id FROM Property_Photos GROUP BY property_id;
Database: real_estate_rentals (tables: property_photos)
Question: Count the number of property photos each property has by id.
SQL: SELECT count(*) ,  property_id FROM Property_Photos GROUP BY property_id;
Database: real_estate_rentals (tables: property_photos, properties)
Question: How many photos does each owner has of his or her properties? List user id and number of photos.
SQL: SELECT T1.owner_user_id ,  count(*) FROM Properties AS T1 JOIN Property_Photos AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.owner_user_id;
Database: real_estate_rentals (tables: property_photos, properties)
Question: What are the user ids of property owners who have property photos, and how many do each of them have?
SQL: SELECT T1.owner_user_id ,  count(*) FROM Properties AS T1 JOIN Property_Photos AS T2 ON T1.property_id  =  T2.property_id GROUP BY T1.owner_user_id;
Database: real_estate_rentals (tables: users, properties)
Question: What is the total max price of the properties owned by single mothers or students?
SQL: SELECT sum(T1.price_max) FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T2.user_category_code  =  'Single Mother' OR T2.user_category_code  =  'Student';
Database: real_estate_rentals (tables: users, properties)
Question: Give the total max price corresponding to any properties owned by single mothers or students.
SQL: SELECT sum(T1.price_max) FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T2.user_category_code  =  'Single Mother' OR T2.user_category_code  =  'Student';
Database: real_estate_rentals (tables: user_property_history, properties)
Question: What are the date stamps and property names for each item of property history, ordered by date stamp?
SQL: SELECT T1.datestamp ,  T2.property_name FROM User_Property_History AS T1 JOIN Properties AS T2 ON T1.property_id  =  T2.property_id ORDER BY datestamp;
Database: real_estate_rentals (tables: user_property_history, properties)
Question: Return the date stamp and property name for each property history event, sorted by date stamp.
SQL: SELECT T1.datestamp ,  T2.property_name FROM User_Property_History AS T1 JOIN Properties AS T2 ON T1.property_id  =  T2.property_id ORDER BY datestamp;
Database: real_estate_rentals (tables: ref_property_types, properties)
Question: What is the description of the most common property type? List the description and code.
SQL: SELECT T1.property_type_description ,  T1.property_type_code FROM Ref_Property_Types AS T1 JOIN Properties AS T2 ON T1.property_type_code  =  T2.property_type_code GROUP BY T1.property_type_code ORDER BY count(*) DESC LIMIT 1;
Database: real_estate_rentals (tables: ref_property_types, properties)
Question: What is the most common property type, and what is its description.
SQL: SELECT T1.property_type_description ,  T1.property_type_code FROM Ref_Property_Types AS T1 JOIN Properties AS T2 ON T1.property_type_code  =  T2.property_type_code GROUP BY T1.property_type_code ORDER BY count(*) DESC LIMIT 1;
Database: real_estate_rentals (tables: ref_age_categories)
Question: What is the detailed description of the age category code 'Over 60'?
SQL: SELECT age_category_description FROM Ref_Age_Categories WHERE age_category_code  =  'Over 60';
Database: real_estate_rentals (tables: ref_age_categories)
Question: Give the category description of the age category 'Over 60'.
SQL: SELECT age_category_description FROM Ref_Age_Categories WHERE age_category_code  =  'Over 60';
Database: real_estate_rentals (tables: rooms)
Question: What are the different room sizes, and how many of each are there?
SQL: SELECT room_size ,  count(*) FROM Rooms GROUP BY room_size
Database: real_estate_rentals (tables: rooms)
Question: Return the number of rooms with each different room size.
SQL: SELECT room_size ,  count(*) FROM Rooms GROUP BY room_size
Database: real_estate_rentals (tables: users, addresses)
Question: In which country does the user with first name Robbie live?
SQL: SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.first_name  =  'Robbie';
Database: real_estate_rentals (tables: users, addresses)
Question: Return the country in which the user with first name Robbie lives.
SQL: SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id  =  T2.user_address_id WHERE T2.first_name  =  'Robbie';
Database: real_estate_rentals (tables: users, properties)
Question: What are the first, middle and last names of users who own the property they live in?
SQL: SELECT first_name ,  middle_name ,  last_name FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T1.property_address_id  =  T2.user_address_id;
Database: real_estate_rentals (tables: users, properties)
Question: Return the full names of users who live in properties that they own.
SQL: SELECT first_name ,  middle_name ,  last_name FROM Properties AS T1 JOIN Users AS T2 ON T1.owner_user_id  =  T2.user_id WHERE T1.property_address_id  =  T2.user_address_id;
Database: real_estate_rentals (tables: properties, user_searches)
Question: List the search content of the users who do not own a single property.
SQL: SELECT search_string FROM User_Searches EXCEPT SELECT T1.search_string FROM User_Searches AS T1 JOIN Properties AS T2 ON T1.user_id  =  T2.owner_user_id;
Database: real_estate_rentals (tables: properties, user_searches)
Question: What search strings were entered by users who do not own any properties?
SQL: SELECT search_string FROM User_Searches EXCEPT SELECT T1.search_string FROM User_Searches AS T1 JOIN Properties AS T2 ON T1.user_id  =  T2.owner_user_id;
Database: real_estate_rentals (tables: users, properties, user_searches)
Question: List the last names and ids of users who have at least 2 properties and searched at most twice.
SQL: SELECT T1.last_name ,  T1.user_id FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id GROUP BY T1.user_id HAVING count(*)  <=  2 INTERSECT SELECT T3.last_name ,  T3.user_id FROM Users AS T3 JOIN Properties AS T4 ON T3.user_id  =  T4.owner_user_id GROUP BY T3.user_id HAVING count(*)  >=  2;
Database: real_estate_rentals (tables: users, properties, user_searches)
Question: What are the last names and ids of users who have searched two or fewer times, and own two or more properties?
SQL: SELECT T1.last_name ,  T1.user_id FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id  =  T2.user_id GROUP BY T1.user_id HAVING count(*)  <=  2 INTERSECT SELECT T3.last_name ,  T3.user_id FROM Users AS T3 JOIN Properties AS T4 ON T3.user_id  =  T4.owner_user_id GROUP BY T3.user_id HAVING count(*)  >=  2;
Database: bike_racing (tables: bike)
Question: How many bikes are heavier than 780 grams?
SQL: SELECT count(*) FROM bike WHERE weight  >  780
Database: bike_racing (tables: bike)
Question: List the product names and weights of the bikes in ascending order of price.
SQL: SELECT product_name ,  weight FROM bike ORDER BY price ASC
Database: bike_racing (tables: cyclist)
Question: List the heat, name, and nation for all the cyclists.
SQL: SELECT heat ,  name ,  nation FROM cyclist
Database: bike_racing (tables: bike)
Question: What are the maximum and minimum weight of all bikes?
SQL: SELECT max(weight) ,  min(weight) FROM bike
Database: bike_racing (tables: bike)
Question: What is the average price of the bikes made of material 'Carbon CC'?
SQL: SELECT avg(price) FROM bike WHERE material  =  'Carbon CC'
Database: bike_racing (tables: cyclist)
Question: What are the name and result of the cyclists not from 'Russia' ?
SQL: SELECT name ,  RESULT FROM cyclist WHERE nation != 'Russia'
Database: bike_racing (tables: bike, cyclists_own_bikes)
Question: What are the distinct ids and product names of the bikes that are purchased after year 2015?
SQL: SELECT DISTINCT T1.id ,  T1.product_name FROM bike AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.bike_id WHERE T2.purchase_year  >  2015
Database: bike_racing (tables: bike, cyclists_own_bikes)
Question: What are the ids and names of racing bikes that are purchased by at least 4 cyclists?
SQL: SELECT T1.id ,  T1.product_name FROM bike AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.bike_id GROUP BY T1.id HAVING count(*)  >=  4
Database: bike_racing (tables: cyclist, cyclists_own_bikes)
Question: What are the id and name of the cyclist who owns the most bikes?
SQL: SELECT T1.id ,  T1.name FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id GROUP BY T1.id ORDER BY count(*) DESC LIMIT 1
Database: bike_racing (tables: cyclist, bike, cyclists_own_bikes)
Question: What are the distinct product names of bikes owned by cyclists from 'Russia' or cyclists from 'Great Britain'?
SQL: SELECT DISTINCT T3.product_name FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id JOIN bike AS T3 ON T2.bike_id  =  T3.id WHERE T1.nation  =  'Russia' OR T1.nation  =  'Great Britain'
Database: bike_racing (tables: cyclist)
Question: How many different levels of heat are there for the cyclists?
SQL: SELECT count(DISTINCT heat) FROM cyclist
Database: bike_racing (tables: cyclist, cyclists_own_bikes)
Question: How many cyclists did not purchase any bike after year 2015?
SQL: SELECT count(*) FROM cyclist WHERE id NOT IN ( SELECT cyclist_id FROM cyclists_own_bikes WHERE purchase_year  >  2015 )
Database: bike_racing (tables: cyclist, bike, cyclists_own_bikes)
Question: What are the names of distinct racing bikes that are purchased by the cyclists with better results than '4:21.558' ?
SQL: SELECT DISTINCT T3.product_name FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id JOIN bike AS T3 ON T2.bike_id  =  T3.id WHERE T1.result  <  '4:21.558'
Database: bike_racing (tables: cyclist, bike, cyclists_own_bikes)
Question: List the name and price of the bike that is owned by both the cyclists named 'Bradley Wiggins' and the cyclist named 'Antonio Tauler'.
SQL: SELECT T3.product_name ,  T3.price FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id JOIN bike AS T3 ON T2.bike_id  =  T3.id WHERE T1.name  =  'Bradley Wiggins' INTERSECT SELECT T3.product_name ,  T3.price FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id JOIN bike AS T3 ON T2.bike_id  =  T3.id WHERE T1.name  =  'Antonio Tauler'
Database: bike_racing (tables: cyclist, cyclists_own_bikes)
Question: Show the name, nation and result for the cyclists who did not purchase any racing bike.
SQL: SELECT name ,  nation ,  RESULT FROM cyclist EXCEPT SELECT T1.name ,  T1.nation ,  T1.result FROM cyclist AS T1 JOIN cyclists_own_bikes AS T2 ON T1.id  =  T2.cyclist_id
Database: bike_racing (tables: bike)
Question: What are the names of the bikes that have substring 'fiber' in their material?
SQL: SELECT product_name FROM bike WHERE material LIKE "%fiber%"
Database: bike_racing (tables: cyclists_own_bikes)
Question: How many bikes does each cyclist own? Order by cyclist id.
SQL: SELECT cyclist_id ,  count(*) FROM cyclists_own_bikes GROUP BY cyclist_id ORDER BY cyclist_id
Database: bakery_1 (tables: goods)
Question: What is the most expensive cake and its flavor?
SQL: SELECT id ,  flavor FROM goods WHERE food  =  "Cake" ORDER BY price DESC LIMIT 1
Database: bakery_1 (tables: goods)
Question: Give the id and flavor of the most expensive cake.
SQL: SELECT id ,  flavor FROM goods WHERE food  =  "Cake" ORDER BY price DESC LIMIT 1
Database: bakery_1 (tables: goods)
Question: What is the cheapest cookie and its flavor?
SQL: SELECT id ,  flavor FROM goods WHERE food  =  "Cookie" ORDER BY price LIMIT 1
Database: bakery_1 (tables: goods)
Question: What is the id and flavor of the cheapest cookie?
SQL: SELECT id ,  flavor FROM goods WHERE food  =  "Cookie" ORDER BY price LIMIT 1
Database: bakery_1 (tables: goods)
Question: Find the ids of goods that have apple flavor.
SQL: SELECT id FROM goods WHERE flavor  =  "Apple"
Database: bakery_1 (tables: goods)
Question: What are the ids with apple flavor?
SQL: SELECT id FROM goods WHERE flavor  =  "Apple"
Database: bakery_1 (tables: goods)
Question: What are the ids of goods that cost less than 3 dollars?
SQL: SELECT id FROM goods WHERE price  <  3
Database: bakery_1 (tables: goods)
Question: Give the ids of goods that cost less than 3 dollars.
SQL: SELECT id FROM goods WHERE price  <  3
Database: bakery_1 (tables: receipts, items, goods)
Question: List the distinct ids of all customers who bought a cake with lemon flavor?
SQL: SELECT DISTINCT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.Id  =  T2.Item JOIN receipts AS T3 ON T2.Receipt  =  T3.ReceiptNumber WHERE T1.Flavor  =  "Lemon" AND T1.Food  =  "Cake"
Database: bakery_1 (tables: receipts, items, goods)
Question: What are the distinct ids of customers who bought lemon flavored cake?
SQL: SELECT DISTINCT T3.CustomerId FROM goods AS T1 JOIN items AS T2 ON T1.Id  =  T2.Item JOIN receipts AS T3 ON T2.Receipt  =  T3.ReceiptNumber WHERE T1.Flavor  =  "Lemon" AND T1.Food  =  "Cake"
Database: bakery_1 (tables: receipts, items, goods)
Question: For each type of food, tell me how many customers have ever bought it.
SQL: SELECT T1.food ,  count(DISTINCT 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 T1.food
Database: bakery_1 (tables: receipts, items, goods)
Question: How many customers have bought each food?
SQL: SELECT T1.food ,  count(DISTINCT 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 T1.food
Database: bakery_1 (tables: receipts)
Question: Find the id of customers who shopped at the bakery at least 15 times.
SQL: SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*)  >=  15
Database: bakery_1 (tables: receipts)
Question: What are the customer ids of customers who have at least 15 receipts?
SQL: SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*)  >=  15
Database: bakery_1 (tables: receipts, customers)
Question: What is the last name of the customers who shopped at the bakery more than 10 times?
SQL: SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId  =  T2.id GROUP BY T2.id HAVING count(*)  >  10
Database: bakery_1 (tables: receipts, customers)
Question: Give the last names of customers who have been to the bakery more than 10 times?
SQL: SELECT T2.LastName FROM receipts AS T1 JOIN customers AS T2 ON T1.CustomerId  =  T2.id GROUP BY T2.id HAVING count(*)  >  10
Database: bakery_1 (tables: goods)
Question: How many types of Cake does this bakery sell?
SQL: SELECT count(*) FROM goods WHERE food  =  "Cake"
Database: bakery_1 (tables: goods)
Question: Count the number of types of cake this bakery sells.
SQL: SELECT count(*) FROM goods WHERE food  =  "Cake"
Database: bakery_1 (tables: goods)
Question: List all the flavors of Croissant available in this bakery.
SQL: SELECT flavor FROM goods WHERE food  =  "Croissant"
Database: bakery_1 (tables: goods)
Question: What are all the flavors of croissant?
SQL: SELECT flavor FROM goods WHERE food  =  "Croissant"
Database: bakery_1 (tables: receipts, items)
Question: Give me a list of all the distinct items bought by the customer number 15.
SQL: SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt  =  T2.ReceiptNumber WHERE T2.CustomerId  =  15
Database: bakery_1 (tables: receipts, items)
Question: What are all the distinct items bought by customer 15?
SQL: SELECT DISTINCT T1.item FROM items AS T1 JOIN receipts AS T2 ON T1.receipt  =  T2.ReceiptNumber WHERE T2.CustomerId  =  15
Database: bakery_1 (tables: goods)
Question: For each type of food, what are the average, maximum and minimum price?
SQL: SELECT food ,  avg(price) ,  max(price) ,  min(price) FROM goods GROUP BY food
Database: bakery_1 (tables: goods)
Question: What are the average, minimum and maximum prices for each food?
SQL: SELECT food ,  avg(price) ,  max(price) ,  min(price) FROM goods GROUP BY food
Database: bakery_1 (tables: items, goods)
Question: Find the receipt numbers where both Cake and Cookie were bought.
SQL: 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"
Database: bakery_1 (tables: items, goods)
Question: What are the receipt numbers for instances where both cakes and cookies were purchased?
SQL: 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"
Database: bakery_1 (tables: receipts, customers, items, goods)
Question: Find all the receipt numbers in which customer with last name LOGAN purchased Croissant.
SQL: 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'
Database: bakery_1 (tables: receipts, customers, items, goods)
Question: What are the receipt numbers for a customer with the last name Logan who purchased a croissant?
SQL: 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'
Database: bakery_1 (tables: receipts, items, goods)
Question: What is the receipt number and date of the receipt in which the most expensive item was bought?
SQL: 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
Database: bakery_1 (tables: receipts, items, goods)
Question: What is the receipt number and date corresponding to the receipt for which the most expensive item was purchased?
SQL: 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
Database: bakery_1 (tables: items)
Question: What is the item that was bought the least number of times?
SQL: SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1
Database: bakery_1 (tables: items)
Question: Which item was bought the fewest times?
SQL: SELECT item FROM items GROUP BY item ORDER BY count(*) LIMIT 1
Database: bakery_1 (tables: goods)
Question: How many goods are available for each food type?
SQL: SELECT count(*) ,  food FROM goods GROUP BY food
Database: bakery_1 (tables: goods)
Question: Count the number of goods for each food type.
SQL: SELECT count(*) ,  food FROM goods GROUP BY food
Database: bakery_1 (tables: goods)
Question: What is the average price for each food type?
SQL: SELECT avg(price) ,  food FROM goods GROUP BY food
Database: bakery_1 (tables: goods)
Question: Give the average price for each food type.
SQL: SELECT avg(price) ,  food FROM goods GROUP BY food
Database: bakery_1 (tables: goods)
Question: What are ids of the goods that have Apricot flavor and are cheaper than 5 dollars?
SQL: SELECT id FROM goods WHERE flavor  =  "Apricot" AND price  <  5