query_id
int64 0
2.15k
| database_id
stringclasses 40
values | table_id
listlengths 1
4
| query
stringlengths 22
185
| answer
stringlengths 22
608
| difficulty
stringclasses 4
values |
---|---|---|---|---|---|
1,400 |
real_estate_rentals
|
[
"addresses",
"properties"
] |
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;
|
easy
|
1,401 |
real_estate_rentals
|
[
"addresses",
"properties"
] |
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;
|
easy
|
1,402 |
real_estate_rentals
|
[
"features"
] |
How is the feature rooftop described?
|
SELECT feature_description FROM Features WHERE feature_name = 'rooftop';
|
easy
|
1,403 |
real_estate_rentals
|
[
"features"
] |
Return the description of the feature 'rooftop'.
|
SELECT feature_description FROM Features WHERE feature_name = 'rooftop';
|
easy
|
1,404 |
real_estate_rentals
|
[
"property_features",
"features"
] |
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;
|
extra
|
1,405 |
real_estate_rentals
|
[
"property_features",
"features"
] |
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;
|
extra
|
1,406 |
real_estate_rentals
|
[
"properties"
] |
What is the minimum number of rooms in a property?
|
SELECT min(room_count) FROM Properties;
|
easy
|
1,407 |
real_estate_rentals
|
[
"properties"
] |
What is the lowest room count across all the properties?
|
SELECT min(room_count) FROM Properties;
|
easy
|
1,408 |
real_estate_rentals
|
[
"properties"
] |
How many properties have 1 parking lot or 1 garage?
|
SELECT count(*) FROM Properties WHERE parking_lots = 1 OR garage_yn = 1;
|
medium
|
1,409 |
real_estate_rentals
|
[
"properties"
] |
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;
|
medium
|
1,410 |
real_estate_rentals
|
[
"ref_user_categories",
"users"
] |
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";
|
hard
|
1,411 |
real_estate_rentals
|
[
"ref_user_categories",
"users"
] |
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";
|
hard
|
1,412 |
real_estate_rentals
|
[
"users",
"properties"
] |
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;
|
extra
|
1,413 |
real_estate_rentals
|
[
"users",
"properties"
] |
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;
|
extra
|
1,414 |
real_estate_rentals
|
[
"properties",
"property_features",
"features"
] |
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';
|
hard
|
1,415 |
real_estate_rentals
|
[
"properties",
"property_features",
"features"
] |
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';
|
hard
|
1,416 |
real_estate_rentals
|
[
"addresses",
"property_features",
"features",
"properties"
] |
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';
|
extra
|
1,417 |
real_estate_rentals
|
[
"addresses",
"property_features",
"features",
"properties"
] |
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';
|
extra
|
1,418 |
real_estate_rentals
|
[
"properties"
] |
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;
|
medium
|
1,419 |
real_estate_rentals
|
[
"properties"
] |
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;
|
medium
|
1,420 |
real_estate_rentals
|
[
"properties"
] |
On average, how many rooms does a property have?
|
SELECT avg(room_count) FROM Properties;
|
easy
|
1,421 |
real_estate_rentals
|
[
"properties"
] |
What is the average number of rooms in a property?
|
SELECT avg(room_count) FROM Properties;
|
easy
|
1,422 |
real_estate_rentals
|
[
"rooms"
] |
How many kinds of room sizes are listed?
|
SELECT count(DISTINCT room_size) FROM Rooms;
|
easy
|
1,423 |
real_estate_rentals
|
[
"rooms"
] |
Return the number of different room sizes.
|
SELECT count(DISTINCT room_size) FROM Rooms;
|
easy
|
1,424 |
real_estate_rentals
|
[
"user_searches"
] |
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;
|
medium
|
1,425 |
real_estate_rentals
|
[
"user_searches"
] |
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;
|
medium
|
1,426 |
real_estate_rentals
|
[
"user_searches"
] |
When was the time of the latest search by a user?
|
SELECT max(search_datetime) FROM User_Searches;
|
easy
|
1,427 |
real_estate_rentals
|
[
"user_searches"
] |
What was the time of the most recent search?
|
SELECT max(search_datetime) FROM User_Searches;
|
easy
|
1,428 |
real_estate_rentals
|
[
"user_searches"
] |
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;
|
medium
|
1,429 |
real_estate_rentals
|
[
"user_searches"
] |
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;
|
medium
|
1,430 |
real_estate_rentals
|
[
"addresses",
"properties"
] |
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 );
|
extra
|
1,431 |
real_estate_rentals
|
[
"addresses",
"properties"
] |
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 );
|
extra
|
1,432 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
medium
|
1,433 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
medium
|
1,434 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
hard
|
1,435 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
hard
|
1,436 |
real_estate_rentals
|
[
"users"
] |
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
|
medium
|
1,437 |
real_estate_rentals
|
[
"users"
] |
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
|
medium
|
1,438 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
medium
|
1,439 |
real_estate_rentals
|
[
"users",
"user_searches"
] |
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;
|
medium
|
1,440 |
real_estate_rentals
|
[
"users"
] |
When did the user with login name ratione register?
|
SELECT date_registered FROM Users WHERE login_name = 'ratione';
|
easy
|
1,441 |
real_estate_rentals
|
[
"users"
] |
What was the registration date for the user whose login name is ratione?
|
SELECT date_registered FROM Users WHERE login_name = 'ratione';
|
easy
|
1,442 |
real_estate_rentals
|
[
"users"
] |
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;
|
medium
|
1,443 |
real_estate_rentals
|
[
"users"
] |
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;
|
medium
|
1,444 |
real_estate_rentals
|
[
"users",
"addresses"
] |
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';
|
medium
|
1,445 |
real_estate_rentals
|
[
"users",
"addresses"
] |
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';
|
medium
|
1,446 |
real_estate_rentals
|
[
"properties"
] |
How many properties are there with at least 2 features?
|
SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*) >= 2;
|
easy
|
1,447 |
real_estate_rentals
|
[
"properties"
] |
Count the number of properties with at least two features.
|
SELECT count(*) FROM Properties GROUP BY property_id HAVING count(*) >= 2;
|
easy
|
1,448 |
real_estate_rentals
|
[
"property_photos"
] |
How many photos does each property have?
|
SELECT count(*) , property_id FROM Property_Photos GROUP BY property_id;
|
medium
|
1,449 |
real_estate_rentals
|
[
"property_photos"
] |
Count the number of property photos each property has by id.
|
SELECT count(*) , property_id FROM Property_Photos GROUP BY property_id;
|
medium
|
1,450 |
real_estate_rentals
|
[
"property_photos",
"properties"
] |
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;
|
medium
|
1,451 |
real_estate_rentals
|
[
"property_photos",
"properties"
] |
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;
|
medium
|
1,452 |
real_estate_rentals
|
[
"users",
"properties"
] |
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';
|
hard
|
1,453 |
real_estate_rentals
|
[
"users",
"properties"
] |
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';
|
hard
|
1,454 |
real_estate_rentals
|
[
"user_property_history",
"properties"
] |
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;
|
medium
|
1,455 |
real_estate_rentals
|
[
"user_property_history",
"properties"
] |
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;
|
medium
|
1,456 |
real_estate_rentals
|
[
"ref_property_types",
"properties"
] |
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;
|
extra
|
1,457 |
real_estate_rentals
|
[
"ref_property_types",
"properties"
] |
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;
|
extra
|
1,458 |
real_estate_rentals
|
[
"ref_age_categories"
] |
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';
|
easy
|
1,459 |
real_estate_rentals
|
[
"ref_age_categories"
] |
Give the category description of the age category 'Over 60'.
|
SELECT age_category_description FROM Ref_Age_Categories WHERE age_category_code = 'Over 60';
|
easy
|
1,460 |
real_estate_rentals
|
[
"rooms"
] |
What are the different room sizes, and how many of each are there?
|
SELECT room_size , count(*) FROM Rooms GROUP BY room_size
|
medium
|
1,461 |
real_estate_rentals
|
[
"rooms"
] |
Return the number of rooms with each different room size.
|
SELECT room_size , count(*) FROM Rooms GROUP BY room_size
|
medium
|
1,462 |
real_estate_rentals
|
[
"users",
"addresses"
] |
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';
|
medium
|
1,463 |
real_estate_rentals
|
[
"users",
"addresses"
] |
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';
|
medium
|
1,464 |
real_estate_rentals
|
[
"users",
"properties"
] |
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;
|
medium
|
1,465 |
real_estate_rentals
|
[
"users",
"properties"
] |
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;
|
medium
|
1,466 |
real_estate_rentals
|
[
"properties",
"user_searches"
] |
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;
|
hard
|
1,467 |
real_estate_rentals
|
[
"properties",
"user_searches"
] |
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;
|
hard
|
1,468 |
real_estate_rentals
|
[
"users",
"properties",
"user_searches"
] |
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;
|
extra
|
1,469 |
real_estate_rentals
|
[
"users",
"properties",
"user_searches"
] |
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;
|
extra
|
1,470 |
bike_racing
|
[
"bike"
] |
How many bikes are heavier than 780 grams?
|
SELECT count(*) FROM bike WHERE weight > 780
|
easy
|
1,471 |
bike_racing
|
[
"bike"
] |
List the product names and weights of the bikes in ascending order of price.
|
SELECT product_name , weight FROM bike ORDER BY price ASC
|
medium
|
1,472 |
bike_racing
|
[
"cyclist"
] |
List the heat, name, and nation for all the cyclists.
|
SELECT heat , name , nation FROM cyclist
|
medium
|
1,473 |
bike_racing
|
[
"bike"
] |
What are the maximum and minimum weight of all bikes?
|
SELECT max(weight) , min(weight) FROM bike
|
medium
|
1,474 |
bike_racing
|
[
"bike"
] |
What is the average price of the bikes made of material 'Carbon CC'?
|
SELECT avg(price) FROM bike WHERE material = 'Carbon CC'
|
easy
|
1,475 |
bike_racing
|
[
"cyclist"
] |
What are the name and result of the cyclists not from 'Russia' ?
|
SELECT name , RESULT FROM cyclist WHERE nation != 'Russia'
|
medium
|
1,476 |
bike_racing
|
[
"bike",
"cyclists_own_bikes"
] |
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
|
medium
|
1,477 |
bike_racing
|
[
"bike",
"cyclists_own_bikes"
] |
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
|
medium
|
1,478 |
bike_racing
|
[
"cyclist",
"cyclists_own_bikes"
] |
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
|
extra
|
1,479 |
bike_racing
|
[
"cyclist",
"bike",
"cyclists_own_bikes"
] |
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'
|
extra
|
1,480 |
bike_racing
|
[
"cyclist"
] |
How many different levels of heat are there for the cyclists?
|
SELECT count(DISTINCT heat) FROM cyclist
|
easy
|
1,481 |
bike_racing
|
[
"cyclist",
"cyclists_own_bikes"
] |
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 )
|
extra
|
1,482 |
bike_racing
|
[
"cyclist",
"bike",
"cyclists_own_bikes"
] |
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'
|
hard
|
1,483 |
bike_racing
|
[
"cyclist",
"bike",
"cyclists_own_bikes"
] |
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 T3 ON T2.bike_id = T3.id WHERE T1.name = 'Antonio Tauler'
|
extra
|
1,484 |
bike_racing
|
[
"cyclist",
"cyclists_own_bikes"
] |
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
|
extra
|
1,485 |
bike_racing
|
[
"bike"
] |
What are the names of the bikes that have substring 'fiber' in their material?
|
SELECT product_name FROM bike WHERE material LIKE "%fiber%"
|
medium
|
1,486 |
bike_racing
|
[
"cyclists_own_bikes"
] |
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
|
medium
|
1,487 |
bakery_1
|
[
"goods"
] |
What is the most expensive cake and its flavor?
|
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY price DESC LIMIT 1
|
hard
|
1,488 |
bakery_1
|
[
"goods"
] |
Give the id and flavor of the most expensive cake.
|
SELECT id , flavor FROM goods WHERE food = "Cake" ORDER BY price DESC LIMIT 1
|
hard
|
1,489 |
bakery_1
|
[
"goods"
] |
What is the cheapest cookie and its flavor?
|
SELECT id , flavor FROM goods WHERE food = "Cookie" ORDER BY price LIMIT 1
|
hard
|
1,490 |
bakery_1
|
[
"goods"
] |
What is the id and flavor of the cheapest cookie?
|
SELECT id , flavor FROM goods WHERE food = "Cookie" ORDER BY price LIMIT 1
|
hard
|
1,491 |
bakery_1
|
[
"goods"
] |
Find the ids of goods that have apple flavor.
|
SELECT id FROM goods WHERE flavor = "Apple"
|
easy
|
1,492 |
bakery_1
|
[
"goods"
] |
What are the ids with apple flavor?
|
SELECT id FROM goods WHERE flavor = "Apple"
|
easy
|
1,493 |
bakery_1
|
[
"goods"
] |
What are the ids of goods that cost less than 3 dollars?
|
SELECT id FROM goods WHERE price < 3
|
easy
|
1,494 |
bakery_1
|
[
"goods"
] |
Give the ids of goods that cost less than 3 dollars.
|
SELECT id FROM goods WHERE price < 3
|
easy
|
1,495 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
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"
|
hard
|
1,496 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
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"
|
hard
|
1,497 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
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
|
hard
|
1,498 |
bakery_1
|
[
"receipts",
"items",
"goods"
] |
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
|
hard
|
1,499 |
bakery_1
|
[
"receipts"
] |
Find the id of customers who shopped at the bakery at least 15 times.
|
SELECT CustomerId FROM receipts GROUP BY CustomerId HAVING count(*) >= 15
|
easy
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.