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