output
stringlengths
18
577
instruction
stringlengths
16
224
input
stringclasses
160 values
SELECT T2.title , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3
What are the names and years of the movies that has the top 3 highest rating star?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID ORDER BY T1.stars DESC LIMIT 3
What are the names and years released for the movies with the top 3 highest ratings?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.stars , T2.director , max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director != "null" GROUP BY director
For each director, return the director's name together with the title of the movie they directed that received the highest rating among all of their movies, and the value of that rating. Ignore movies whose director is NULL.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.stars , T2.director , max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE director != "null" GROUP BY director
For each director, what are the titles and ratings for all the movies they reviewed?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.rID , T1.stars , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID
Find the title and star rating of the movie that got the least rating star for each reviewer.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.rID , T1.stars , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.rID
For each reviewer id, what is the title and rating for the movie with the smallest rating?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.stars , T2.director , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director
Find the title and score of the movie with the lowest rating among all movies directed by each director.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.stars , T2.director , min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T2.director
For each director, what is the title and score of their most poorly rated movie?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY count(*) DESC LIMIT 1
What is the name of the movie that is rated by most of times?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title , T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY count(*) DESC LIMIT 1
What is the name of the movie that has been reviewed the most?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5
What are the titles of all movies that have rating star is between 3 and 5?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5
What are the titles of all movies that have between 3 and 5 stars?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3
Find the names of reviewers who had given higher than 3 star ratings.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3
What are the names of the reviewers who have rated a movie more than 3 stars before?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID , avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
Find the average rating star for each movie that are not reviewed by Brittany Harris.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID , avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris") GROUP BY mID
What is the average rating for each movie that has never been reviewed by Brittany Harris?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris"
What are the ids of the movies that are not reviewed by Brittany Harris.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T2.name = "Brittany Harris"
What are the ids of all moviest hat have not been reviewed by Britanny Harris?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID , avg(stars) FROM Rating GROUP BY mID HAVING count(*) >= 2
Find the average rating star for each movie that received at least 2 ratings.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT mID , avg(stars) FROM Rating GROUP BY mID HAVING count(*) >= 2
For each movie that received more than 3 reviews, what is the average rating?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4
find the ids of reviewers who did not give 4 star.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4
What are the ids of all reviewers who did not give 4 stars?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT rID FROM Rating WHERE stars != 4
Find the ids of reviewers who didn't only give 4 star.
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT rID FROM Rating WHERE stars != 4
What are the ids of all reviewers who have not given 4 stars at least once?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2.year > 2000
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T3.name = 'Brittany Harris' OR T2.year > 2000
What are the names of all movies that were made after 2000 or reviewed by Brittany Harris?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT title FROM Movie WHERE director = "James Cameron" OR YEAR < 1980
What are names of the movies that are either made before 1980 or directed by James Cameron?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT title FROM Movie WHERE director = "James Cameron" OR YEAR < 1980
What are the names of all movies made before 1980 or had James Cameron as the director?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4
What are the names of reviewers who had rated 3 star and 4 star?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars = 4
What are the names of all reviewers that have given 3 or 4 stars for reviews?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 4
What are the names of movies that get 3 star and 4 star?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 3 INTERSECT SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars = 4
What are the names of all movies that received 3 or 4 stars?
"Schema (values (type))": Movie : mID (number) , title (text) , year (number) , director (text) | Reviewer : rID (number) , name (text) | Rating : rID (number) , mID (number) , stars (number) , ratingDate (time) "Primary Keys": Movie : mID | Reviewer : rID "Foreign Keys": Rating : rID equals Reviewer : rID | Rating : mID equals Movie : mID
SELECT count(*) FROM county_public_safety
How many counties are there?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT count(*) FROM county_public_safety
Count the number of countries.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety ORDER BY Population DESC
List the names of counties in descending order of population.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety ORDER BY Population DESC
What are the names of the counties of public safety, ordered by population descending?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION != "East"
List the distinct police forces of counties whose location is not on east side.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION != "East"
What are the different police forces of counties that are not located in the East?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT min(Crime_rate) , max(Crime_rate) FROM county_public_safety
What are the minimum and maximum crime rate of counties?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT min(Crime_rate) , max(Crime_rate) FROM county_public_safety
Return the minimum and maximum crime rates across all counties.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC
Show the crime rates of counties in ascending order of number of police officers.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC
What are the crime rates of counties sorted by number of offices ascending?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM city ORDER BY Name ASC
What are the names of cities in ascending alphabetical order?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM city ORDER BY Name ASC
Return the names of cities, ordered alphabetically.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Hispanic FROM city WHERE Black > 10
What are the percentage of hispanics in cities with the black percentage higher than 10?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Hispanic FROM city WHERE Black > 10
Return the hispanic percentage for cities in which the black percentage is greater than 10.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1
List the name of the county with the largest population.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1
What is the name of the county with the greatest population?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM city ORDER BY White DESC LIMIT 5
List the names of the city with the top 5 white percentages.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM city ORDER BY White DESC LIMIT 5
What are the names of the five cities with the greatest proportion of white people?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T1.Name , T2.Name FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID
Show names of cities and names of counties they are in.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T1.Name , T2.Name FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID
What are the names of cities, as well as the names of the counties they correspond to?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T1.White , T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID
Show white percentages of cities and the crime rates of counties they are in.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T1.White , T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID
What are the white percentages of cities, and the corresponding crime rates of the counties they correspond to?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)
Show the name of cities in the county that has the largest number of police officers.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)
What are the names of cities that are in the county with the most police officers?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT count(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)
Show the number of cities in counties that have a population more than 20000.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT count(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)
How many cities are in counties that have populations of over 20000?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90
Show the crime rate of counties with a city having white percentage more than 90.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT T2.Crime_rate FROM city AS T1 JOIN county_public_safety AS T2 ON T1.County_ID = T2.County_ID WHERE T1.White > 90
What are the crime rates of counties that contain cities that have white percentages of over 90?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Police_force , COUNT(*) FROM county_public_safety GROUP BY Police_force
Please show the police forces and the number of counties with each police force.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Police_force , COUNT(*) FROM county_public_safety GROUP BY Police_force
How many counties correspond to each police force?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
What is the location shared by most counties?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1
Which location has the most corresponding counties?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city)
List the names of counties that do not have any cities.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Name FROM county_public_safety WHERE County_ID NOT IN (SELECT County_ID FROM city)
What are the names of counties that do not contain any cities?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Police_force FROM county_public_safety WHERE LOCATION = "East" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = "West"
Show the police force shared by counties with location on the east and west.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Police_force FROM county_public_safety WHERE LOCATION = "East" INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = "West"
Which police forces operate in both counties that are located in the East and in the West?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)
Show the names of cities in counties that have a crime rate less than 100.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)
What are the names of cities that are in counties that have a crime rate below 100?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Case_burden FROM county_public_safety ORDER BY Population DESC
Show the case burden of counties in descending order of population.
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT Case_burden FROM county_public_safety ORDER BY Population DESC
What are the case burdens of counties, ordered descending by population?
"Schema (values (type))": county_public_safety : County_ID (number) , Name (text) , Population (number) , Police_officers (number) , Residents_per_officer (number) , Case_burden (number) , Crime_rate (number) , Police_force (text) , Location (text) | city : City_ID (number) , County_ID (number) , Name (text) , White (number) , Black (number) , Amerindian (number) , Asian (number) , Multiracial (number) , Hispanic (number) "Primary Keys": county_public_safety : County_ID | city : City_ID "Foreign Keys": city : County_ID equals county_public_safety : County_ID
SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern';
Find the names of all modern rooms with a base price below $160 and two beds.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern';
What are the names of modern rooms that have a base price lower than $160 and two beds.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2;
Find all the rooms that have a price higher than 160 and can accommodate more than 2 people. Report room names and ids.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2;
What are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY count(*) DESC LIMIT 1;
Find the most popular room in the hotel. The most popular room is the room that had seen the largest number of reservations.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY count(*) DESC LIMIT 1;
Which room has the largest number of reservations?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT kids FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY";
How many kids stay in the rooms reserved by ROY SWEAZY?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT kids FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY";
Find the number of kids staying in the rooms reserved by a person called ROY SWEAZ.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT count(*) FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY";
How many times does ROY SWEAZY has reserved a room.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT count(*) FROM Reservations WHERE FirstName = "ROY" AND LastName = "SWEAZY";
Find the number of times ROY SWEAZY has reserved a room.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT T2.roomName , T1.Rate , T1.CheckIn , T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1;
Which room has the highest rate? List the room's full name, rate, check in and check out date.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT T2.roomName , T1.Rate , T1.CheckIn , T1.CheckOut FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room ORDER BY T1.Rate DESC LIMIT 1;
Return the name, rate, check in and check out date for the room with the highest rate.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT Adults FROM Reservations WHERE CheckIn = "2010-10-23" AND FirstName = "CONRAD" AND LastName = "SELBIG";
How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT Adults FROM Reservations WHERE CheckIn = "2010-10-23" AND FirstName = "CONRAD" AND LastName = "SELBIG";
Find the number of adults for the room reserved and checked in by CONRAD SELBIG on Oct 23, 2010.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT Kids FROM Reservations WHERE CheckIn = "2010-09-21" AND FirstName = "DAMIEN" AND LastName = "TRACHSEL";
How many kids stay in the room DAMIEN TRACHSEL checked in on Sep 21, 2010?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT Kids FROM Reservations WHERE CheckIn = "2010-09-21" AND FirstName = "DAMIEN" AND LastName = "TRACHSEL";
Return the number of kids for the room reserved and checked in by DAMIEN TRACHSEL on Sep 21, 2010.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT sum(beds) FROM Rooms WHERE bedtype = 'King';
How many king beds are there?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT sum(beds) FROM Rooms WHERE bedtype = 'King';
Find the total number of king beds available.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice;
List the names and decor of rooms that have a king bed. Sort the list by their price.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice;
What are the names and decor of rooms with a king bed? Sort them by their price
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , basePrice FROM Rooms ORDER BY basePrice ASC LIMIT 1;
Which room has cheapest base price? List the room's name and the base price.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT roomName , basePrice FROM Rooms ORDER BY basePrice ASC LIMIT 1;
What are the room name and base price of the room with the lowest base price?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT decor FROM Rooms WHERE roomName = "Recluse and defiance";
What is the decor of room Recluse and defiance?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT decor FROM Rooms WHERE roomName = "Recluse and defiance";
Return the decor of the room named "Recluse and defiance".
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType;
What is the average base price of different bed type? List bed type and average base price.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT bedType , avg(basePrice) FROM Rooms GROUP BY bedType;
For each bed type, find the average base price of different bed type.
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT sum(maxOccupancy) FROM Rooms WHERE decor = 'modern';
What is the total number of people who could stay in the modern rooms in this inn?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId
SELECT sum(maxOccupancy) FROM Rooms WHERE decor = 'modern';
How many people in total can stay in the modern rooms of this inn?
"Schema (values (type))": Rooms : RoomId (text) , roomName (text) , beds (number) , bedType (text) , maxOccupancy (number) , basePrice (number) , decor (text) | Reservations : Code (number) , Room (text) , CheckIn (text) , CheckOut (text) , Rate (number) , LastName (text) , FirstName (text) , Adults (number) , Kids (number) "Primary Keys": Rooms : RoomId | Reservations : Code "Foreign Keys": Reservations : Room equals Rooms : RoomId