nl
stringlengths
22
185
sql
stringlengths
22
608
db_id
stringclasses
40 values
table_schema
stringclasses
305 values
In which states are each of the the properties located?
SELECT DISTINCT T1.county_state_province FROM Addresses AS T1 JOIN Properties AS T2 ON T1.address_id = T2.property_address_id;
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
Give the states or provinces corresponding to each property.
SELECT DISTINCT T1.county_state_province FROM Addresses AS T1 JOIN Properties AS T2 ON T1.address_id = T2.property_address_id;
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
How is the feature rooftop described?
SELECT feature_description FROM Features WHERE feature_name = 'rooftop';
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}]
Return the description of the feature 'rooftop'.
SELECT feature_description FROM Features WHERE feature_name = 'rooftop';
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}]
What are the feature name and description of the most commonly seen feature across properties?
SELECT T1.feature_name , T1.feature_description FROM Features AS T1 JOIN Property_Features AS T2 ON T1.feature_id = T2.feature_id GROUP BY T1.feature_name ORDER BY count(*) DESC LIMIT 1;
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}, {'table_name': 'property features', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'feature id'}, {'col_nam...
Give the feature name and description for the most common feature across all properties.
SELECT T1.feature_name , T1.feature_description FROM Features AS T1 JOIN Property_Features AS T2 ON T1.feature_id = T2.feature_id GROUP BY T1.feature_name ORDER BY count(*) DESC LIMIT 1;
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}, {'table_name': 'property features', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'feature id'}, {'col_nam...
What is the minimum number of rooms in a property?
SELECT min(room_count) FROM Properties;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What is the lowest room count across all the properties?
SELECT min(room_count) FROM Properties;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
How many properties have 1 parking lot or 1 garage?
SELECT count(*) FROM Properties WHERE parking_lots = 1 OR garage_yn = 1;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
Count the number of properties that have 1 parking lot or 1 garage.
SELECT count(*) FROM Properties WHERE parking_lots = 1 OR garage_yn = 1;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
For users whose description contain the string 'Mother', which age categories are they in?
SELECT T2.age_category_code FROM Ref_User_Categories AS T1 JOIN Users AS T2 ON T1.user_category_code = T2.user_category_code WHERE T1.User_category_description LIKE "%Mother";
real_estate_rentals
[{'table_name': 'ref user categories', 'table_schema': [{'col_name': 'user category code'}, {'col_name': 'user category description'}], 'foreign_key_columns': [], 'primary_keys': ['user category code']}, {'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'u...
What are the age categories for users whose description contains the string Mother?
SELECT T2.age_category_code FROM Ref_User_Categories AS T1 JOIN Users AS T2 ON T1.user_category_code = T2.user_category_code WHERE T1.User_category_description LIKE "%Mother";
real_estate_rentals
[{'table_name': 'ref user categories', 'table_schema': [{'col_name': 'user category code'}, {'col_name': 'user category description'}], 'foreign_key_columns': [], 'primary_keys': ['user category code']}, {'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'u...
What is the first name of the user who owns the greatest number of properties?
SELECT T1.first_name FROM Users AS T1 JOIN Properties AS T2 ON T2.owner_user_id = T1.User_id GROUP BY T1.User_id ORDER BY count(*) DESC LIMIT 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Return the first name of the user who owns the most properties.
SELECT T1.first_name FROM Users AS T1 JOIN Properties AS T2 ON T2.owner_user_id = T1.User_id GROUP BY T1.User_id ORDER BY count(*) DESC LIMIT 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
List the average room count of the properties with gardens.
SELECT avg(T3.room_count) FROM Property_Features AS T1 JOIN Features AS T2 ON T1.feature_id = T2.feature_id JOIN Properties AS T3 ON T1.property_id = T3.property_id WHERE T2.feature_name = 'garden';
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}, {'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_n...
On average, how many rooms do properties with garden features have?
SELECT avg(T3.room_count) FROM Property_Features AS T1 JOIN Features AS T2 ON T1.feature_id = T2.feature_id JOIN Properties AS T3 ON T1.property_id = T3.property_id WHERE T2.feature_name = 'garden';
real_estate_rentals
[{'table_name': 'features', 'table_schema': [{'col_name': 'feature id'}, {'col_name': 'feature name'}, {'col_name': 'feature description'}], 'foreign_key_columns': [], 'primary_keys': ['feature id']}, {'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_n...
In which cities are there any properties equipped with a swimming pool?
SELECT T2.town_city FROM Properties AS T1 JOIN Addresses AS T2 ON T1.property_address_id = T2.address_id JOIN Property_Features AS T3 ON T1.property_id = T3.property_id JOIN Features AS T4 ON T4.feature_id = T3.feature_id WHERE T4.feature_name = 'swimming pool';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
Return the cities in which there exist properties that have swimming pools.
SELECT T2.town_city FROM Properties AS T1 JOIN Addresses AS T2 ON T1.property_address_id = T2.address_id JOIN Property_Features AS T3 ON T1.property_id = T3.property_id JOIN Features AS T4 ON T4.feature_id = T3.feature_id WHERE T4.feature_name = 'swimming pool';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
Which property had the lowest price requested by the vendor? List the id and the price.
SELECT property_id , vendor_requested_price FROM Properties ORDER BY vendor_requested_price LIMIT 1;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What is the id of the property that had the lowest requested price from the vendor, and what was that price?
SELECT property_id , vendor_requested_price FROM Properties ORDER BY vendor_requested_price LIMIT 1;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
On average, how many rooms does a property have?
SELECT avg(room_count) FROM Properties;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What is the average number of rooms in a property?
SELECT avg(room_count) FROM Properties;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
How many kinds of room sizes are listed?
SELECT count(DISTINCT room_size) FROM Rooms;
real_estate_rentals
[{'table_name': 'rooms', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'room number'}, {'col_name': 'room type code'}, {'col_name': 'room size'}, {'col_name': 'other room details'}], 'foreign_key_columns': ['room type code', 'property id'], 'primary_keys': []}]
Return the number of different room sizes.
SELECT count(DISTINCT room_size) FROM Rooms;
real_estate_rentals
[{'table_name': 'rooms', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'room number'}, {'col_name': 'room type code'}, {'col_name': 'room size'}, {'col_name': 'other room details'}], 'foreign_key_columns': ['room type code', 'property id'], 'primary_keys': []}]
What are the ids of users who have searched at least twice, and what did they search?
SELECT search_seq , user_id FROM User_Searches GROUP BY user_id HAVING count(*) >= 2;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
Return the ids of users who have performed two or more searches, as well as their search sequence.
SELECT search_seq , user_id FROM User_Searches GROUP BY user_id HAVING count(*) >= 2;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
When was the time of the latest search by a user?
SELECT max(search_datetime) FROM User_Searches;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
What was the time of the most recent search?
SELECT max(search_datetime) FROM User_Searches;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
What are all the user searches time and content? Sort the result descending by content.
SELECT search_datetime , search_string FROM User_Searches ORDER BY search_string DESC;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
Return the search strings and corresonding time stamps for all user searches, sorted by search string descending.
SELECT search_datetime , search_string FROM User_Searches ORDER BY search_string DESC;
real_estate_rentals
[{'table_name': 'user searches', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'search seq'}, {'col_name': 'search datetime'}, {'col_name': 'search string'}], 'foreign_key_columns': ['user id'], 'primary_keys': []}]
What are the zip codes of properties which do not belong to users who own at most 2 properties?
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 );
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
Return the zip codes for properties not belonging to users who own two or fewer properties.
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 );
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
What are the users making only one search? List both category and user id.
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What are the ids of users who have only made one search, and what are their category codes?
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What is the age range category of the user who made the first search?
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Return the age category for the user who made the earliest search.
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Find the login names of all senior citizen users ordered by their first names.
SELECT login_name FROM Users WHERE user_category_code = 'Senior Citizen' ORDER BY first_name
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What are the login names of all senior citizens, sorted by first name?
SELECT login_name FROM Users WHERE user_category_code = 'Senior Citizen' ORDER BY first_name
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
How many searches do buyers make in total?
SELECT count(*) FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id = T2.user_id WHERE T1.is_buyer = 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Count the number of searches made by buyers.
SELECT count(*) FROM Users AS T1 JOIN User_Searches AS T2 ON T1.user_id = T2.user_id WHERE T1.is_buyer = 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
When did the user with login name ratione register?
SELECT date_registered FROM Users WHERE login_name = 'ratione';
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What was the registration date for the user whose login name is ratione?
SELECT date_registered FROM Users WHERE login_name = 'ratione';
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
List the first name, middle name and last name, and log in name of all the seller users, whose seller value is 1.
SELECT first_name , middle_name , last_name , login_name FROM Users WHERE is_seller = 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What are the first, middle, last, and login names for all users who are sellers?
SELECT first_name , middle_name , last_name , login_name FROM Users WHERE is_seller = 1;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Where do the Senior Citizens live? List building, street, and the city.
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';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
What are the buildings, streets, and cities corresponding to the addresses of senior citizens?
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';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
How many properties are there with at least 2 features?
SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*) >= 2;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
Count the number of properties with at least two features.
SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*) >= 2;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
How many photos does each property have?
SELECT count(*) , property_id FROM Property_Photos GROUP BY property_id;
real_estate_rentals
[{'table_name': 'property photos', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'photo seq'}, {'col_name': 'photo title'}, {'col_name': 'photo description'}, {'col_name': 'photo filename'}], 'foreign_key_columns': ['property id'], 'primary_keys': []}]
Count the number of property photos each property has by id.
SELECT count(*) , property_id FROM Property_Photos GROUP BY property_id;
real_estate_rentals
[{'table_name': 'property photos', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'photo seq'}, {'col_name': 'photo title'}, {'col_name': 'photo description'}, {'col_name': 'photo filename'}], 'foreign_key_columns': ['property id'], 'primary_keys': []}]
How many photos does each owner has of his or her properties? List user id and number of photos.
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What are the user ids of property owners who have property photos, and how many do each of them have?
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What is the total max price of the properties owned by single mothers or students?
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';
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Give the total max price corresponding to any properties owned by single mothers or students.
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';
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What are the date stamps and property names for each item of property history, ordered by date stamp?
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
Return the date stamp and property name for each property history event, sorted by date stamp.
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What is the description of the most common property type? List the description and code.
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;
real_estate_rentals
[{'table_name': 'ref property types', 'table_schema': [{'col_name': 'property type code'}, {'col_name': 'property type description'}], 'foreign_key_columns': [], 'primary_keys': ['property type code']}, {'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col...
What is the most common property type, and what is its description.
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;
real_estate_rentals
[{'table_name': 'ref property types', 'table_schema': [{'col_name': 'property type code'}, {'col_name': 'property type description'}], 'foreign_key_columns': [], 'primary_keys': ['property type code']}, {'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col...
What is the detailed description of the age category code 'Over 60'?
SELECT age_category_description FROM Ref_Age_Categories WHERE age_category_code = 'Over 60';
real_estate_rentals
[{'table_name': 'ref age categories', 'table_schema': [{'col_name': 'age category code'}, {'col_name': 'age category description'}], 'foreign_key_columns': [], 'primary_keys': ['age category code']}]
Give the category description of the age category 'Over 60'.
SELECT age_category_description FROM Ref_Age_Categories WHERE age_category_code = 'Over 60';
real_estate_rentals
[{'table_name': 'ref age categories', 'table_schema': [{'col_name': 'age category code'}, {'col_name': 'age category description'}], 'foreign_key_columns': [], 'primary_keys': ['age category code']}]
What are the different room sizes, and how many of each are there?
SELECT room_size , count(*) FROM Rooms GROUP BY room_size
real_estate_rentals
[{'table_name': 'rooms', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'room number'}, {'col_name': 'room type code'}, {'col_name': 'room size'}, {'col_name': 'other room details'}], 'foreign_key_columns': ['room type code', 'property id'], 'primary_keys': []}]
Return the number of rooms with each different room size.
SELECT room_size , count(*) FROM Rooms GROUP BY room_size
real_estate_rentals
[{'table_name': 'rooms', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'room number'}, {'col_name': 'room type code'}, {'col_name': 'room size'}, {'col_name': 'other room details'}], 'foreign_key_columns': ['room type code', 'property id'], 'primary_keys': []}]
In which country does the user with first name Robbie live?
SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id = T2.user_address_id WHERE T2.first_name = 'Robbie';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
Return the country in which the user with first name Robbie lives.
SELECT T1.country FROM Addresses AS T1 JOIN Users AS T2 ON T1.address_id = T2.user_address_id WHERE T2.first_name = 'Robbie';
real_estate_rentals
[{'table_name': 'addresses', 'table_schema': [{'col_name': 'address id'}, {'col_name': 'line 1 number building'}, {'col_name': 'line 2 number street'}, {'col_name': 'line 3 area locality'}, {'col_name': 'town city'}, {'col_name': 'zip postcode'}, {'col_name': 'county state province'}, {'col_name': 'country'}, {'col_nam...
What are the first, middle and last names of users who own the property they live in?
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
Return the full names of users who live in properties that they own.
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
List the search content of the users who do not own a single property.
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
What search strings were entered by users who do not own any properties?
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;
real_estate_rentals
[{'table_name': 'properties', 'table_schema': [{'col_name': 'property id'}, {'col_name': 'property address id'}, {'col_name': 'owner user id'}, {'col_name': 'property type code'}, {'col_name': 'date on market'}, {'col_name': 'date off market'}, {'col_name': 'property name'}, {'col_name': 'property description'}, {'col_...
List the last names and ids of users who have at least 2 properties and searched at most twice.
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
What are the last names and ids of users who have searched two or fewer times, and own two or more properties?
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;
real_estate_rentals
[{'table_name': 'users', 'table_schema': [{'col_name': 'user id'}, {'col_name': 'age category code'}, {'col_name': 'user category code'}, {'col_name': 'user address id'}, {'col_name': 'is buyer'}, {'col_name': 'is seller'}, {'col_name': 'login name'}, {'col_name': 'password'}, {'col_name': 'date registered'}, {'col_nam...
How many bikes are heavier than 780 grams?
SELECT count(*) FROM bike WHERE weight > 780
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
List the product names and weights of the bikes in ascending order of price.
SELECT product_name , weight FROM bike ORDER BY price ASC
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
List the heat, name, and nation for all the cyclists.
SELECT heat , name , nation FROM cyclist
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What are the maximum and minimum weight of all bikes?
SELECT max(weight) , min(weight) FROM bike
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What is the average price of the bikes made of material 'Carbon CC'?
SELECT avg(price) FROM bike WHERE material = 'Carbon CC'
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What are the name and result of the cyclists not from 'Russia' ?
SELECT name , RESULT FROM cyclist WHERE nation != 'Russia'
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
What are the distinct ids and product names of the bikes that are purchased after year 2015?
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
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id...
What are the ids and names of racing bikes that are purchased by at least 4 cyclists?
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
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id...
What are the id and name of the cyclist who owns the most bikes?
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
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id'}, {'co...
What are the distinct product names of bikes owned by cyclists from 'Russia' or cyclists from 'Great Britain'?
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'
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name...
How many different levels of heat are there for the cyclists?
SELECT count(DISTINCT heat) FROM cyclist
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
How many cyclists did not purchase any bike after year 2015?
SELECT count(*) FROM cyclist WHERE id NOT IN ( SELECT cyclist_id FROM cyclists_own_bikes WHERE purchase_year > 2015 )
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id'}, {'co...
What are the names of distinct racing bikes that are purchased by the cyclists with better results than '4:21.558' ?
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'
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name...
List the name and price of the bike that is owned by both the cyclists named 'Bradley Wiggins' and the cyclist named 'Antonio Tauler'.
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...
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name...
Show the name, nation and result for the cyclists who did not purchase any racing bike.
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
bike_racing
[{'table_name': 'cyclist', 'table_schema': [{'col_name': 'id'}, {'col_name': 'heat'}, {'col_name': 'name'}, {'col_name': 'nation'}, {'col_name': 'result'}], 'foreign_key_columns': [], 'primary_keys': ['id']}, {'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id'}, {'co...
What are the names of the bikes that have substring 'fiber' in their material?
SELECT product_name FROM bike WHERE material LIKE "%fiber%"
bike_racing
[{'table_name': 'bike', 'table_schema': [{'col_name': 'id'}, {'col_name': 'product name'}, {'col_name': 'weight'}, {'col_name': 'price'}, {'col_name': 'material'}], 'foreign_key_columns': [], 'primary_keys': ['id']}]
How many bikes does each cyclist own? Order by cyclist id.
SELECT cyclist_id , count(*) FROM cyclists_own_bikes GROUP BY cyclist_id ORDER BY cyclist_id
bike_racing
[{'table_name': 'cyclists own bikes', 'table_schema': [{'col_name': 'cyclist id'}, {'col_name': 'bike id'}, {'col_name': 'purchase year'}], 'foreign_key_columns': ['bike id', 'cyclist id'], 'primary_keys': ['cyclist id']}]
What is the most expensive cake and its flavor?
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY 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']}]
Give the id and flavor of the most expensive cake.
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY 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']}]
What is the cheapest cookie and its flavor?
SELECT id , flavor FROM goods WHERE food = "Cookie" ORDER BY price 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']}]
What is the id and flavor of the cheapest cookie?
SELECT id , flavor FROM goods WHERE food = "Cookie" ORDER BY price 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']}]
Find the ids of goods that have apple flavor.
SELECT id FROM goods WHERE flavor = "Apple"
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 with apple flavor?
SELECT id FROM goods WHERE flavor = "Apple"
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 that cost less than 3 dollars?
SELECT id FROM goods WHERE price < 3
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 cost less than 3 dollars.
SELECT id FROM goods WHERE price < 3
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 distinct ids of all customers who bought a cake with lemon flavor?
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"
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 distinct ids of customers who bought lemon flavored cake?
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"
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':...
For each type of food, tell me how many customers have ever bought it.
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
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 customers have bought each food?
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
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 id of customers who shopped at the bakery at least 15 times.
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']}]