db_id
stringlengths
4
31
SQL
stringlengths
18
1.45k
input_sequence
stringlengths
148
11k
question
stringlengths
16
325
movie_1
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
Question: what are the names and years of the movies that has the top 3 highest rating star? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names and years of the movies that has the top 3 highest rating star?
movie_1
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
Question: what are the names and years released for the movies with the top 3 highest ratings? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names and years released for the movies with the top 3 highest ratings?
movie_1
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
Question: 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. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, ...
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.
movie_1
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
Question: for each director, what are the titles and ratings for all the movies they reviewed? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
for each director, what are the titles and ratings for all the movies they reviewed?
movie_1
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
Question: find the title and star rating of the movie that got the least rating star for each reviewer. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the title and star rating of the movie that got the least rating star for each reviewer.
movie_1
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
Question: for each reviewer id, what is the title and rating for the movie with the smallest rating? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
for each reviewer id, what is the title and rating for the movie with the smallest rating?
movie_1
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
Question: find the title and score of the movie with the lowest rating among all movies directed by each director. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the title and score of the movie with the lowest rating among all movies directed by each director.
movie_1
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
Question: for each director, what is the title and score of their most poorly rated movie? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
for each director, what is the title and score of their most poorly rated movie?
movie_1
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
Question: what is the name of the movie that is rated by most of times? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what is the name of the movie that is rated by most of times?
movie_1
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
Question: what is the name of the movie that has been reviewed the most? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what is the name of the movie that has been reviewed the most?
movie_1
select t2.title from rating as t1 join movie as t2 on t1.mid = t2.mid where t1.stars between 3 and 5
Question: what are the titles of all movies that have rating star is between 3 and 5? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the titles of all movies that have rating star is between 3 and 5?
movie_1
select t2.title from rating as t1 join movie as t2 on t1.mid = t2.mid where t1.stars between 3 and 5
Question: what are the titles of all movies that have between 3 and 5 stars? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the titles of all movies that have between 3 and 5 stars?
movie_1
select t2.name from rating as t1 join reviewer as t2 on t1.rid = t2.rid where t1.stars > 3
Question: find the names of reviewers who had given higher than 3 star ratings. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the names of reviewers who had given higher than 3 star ratings.
movie_1
select t2.name from rating as t1 join reviewer as t2 on t1.rid = t2.rid where t1.stars > 3
Question: what are the names of the reviewers who have rated a movie more than 3 stars before? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of the reviewers who have rated a movie more than 3 stars before?
movie_1
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
Question: find the average rating star for each movie that are not reviewed by brittany harris. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the average rating star for each movie that are not reviewed by brittany harris.
movie_1
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
Question: what is the average rating for each movie that has never been reviewed by brittany harris? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what is the average rating for each movie that has never been reviewed by brittany harris?
movie_1
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'
Question: what are the ids of the movies that are not reviewed by brittany harris. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the ids of the movies that are not reviewed by brittany harris.
movie_1
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'
Question: what are the ids of all moviest hat have not been reviewed by britanny harris? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the ids of all moviest hat have not been reviewed by britanny harris?
movie_1
select mid , avg(stars) from rating group by mid having count(*) >= 2
Question: find the average rating star for each movie that received at least 2 ratings. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the average rating star for each movie that received at least 2 ratings.
movie_1
select mid , avg(stars) from rating group by mid having count(*) >= 2
Question: for each movie that received more than 3 reviews, what is the average rating? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
for each movie that received more than 3 reviews, what is the average rating?
movie_1
select rid from rating except select rid from rating where stars = 4
Question: find the ids of reviewers who did not give 4 star. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the ids of reviewers who did not give 4 star.
movie_1
select rid from rating except select rid from rating where stars = 4
Question: what are the ids of all reviewers who did not give 4 stars? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the ids of all reviewers who did not give 4 stars?
movie_1
select rid from rating where stars != 4
Question: find the ids of reviewers who didn't only give 4 star. | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
find the ids of reviewers who didn't only give 4 star.
movie_1
select rid from rating where stars != 4
Question: what are the ids of all reviewers who have not given 4 stars at least once? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the ids of all reviewers who have not given 4 stars at least once?
movie_1
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
Question: what are names of the movies that are either made after 2000 or reviewed by brittany harris? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are names of the movies that are either made after 2000 or reviewed by brittany harris?
movie_1
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
Question: what are the names of all movies that were made after 2000 or reviewed by brittany harris? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of all movies that were made after 2000 or reviewed by brittany harris?
movie_1
select title from movie where director = 'james cameron' or year < 1980
Question: what are names of the movies that are either made before 1980 or directed by james cameron? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are names of the movies that are either made before 1980 or directed by james cameron?
movie_1
select title from movie where director = 'james cameron' or year < 1980
Question: what are the names of all movies made before 1980 or had james cameron as the director? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of all movies made before 1980 or had james cameron as the director?
movie_1
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
Question: what are the names of reviewers who had rated 3 star and 4 star? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of reviewers who had rated 3 star and 4 star?
movie_1
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
Question: what are the names of all reviewers that have given 3 or 4 stars for reviews? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of all reviewers that have given 3 or 4 stars for reviews?
movie_1
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
Question: what are the names of movies that get 3 star and 4 star? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of movies that get 3 star and 4 star?
movie_1
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
Question: what are the names of all movies that received 3 or 4 stars? | Tables: Movie -> mID, title, year, director. Reviewer -> rID, name. Rating -> rID, mID, stars, ratingDate. | Joins: Rating.rID = Reviewer.rID, Rating.mID = Movie.mID,
what are the names of all movies that received 3 or 4 stars?
county_public_safety
select count(*) from county_public_safety
Question: how many counties are there? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.County_ID = county_public...
how many counties are there?
county_public_safety
select count(*) from county_public_safety
Question: count the number of countries. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.County_ID = county_publ...
count the number of countries.
county_public_safety
select name from county_public_safety order by population desc
Question: list the names of counties in descending order of population. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Join...
list the names of counties in descending order of population.
county_public_safety
select name from county_public_safety order by population desc
Question: what are the names of the counties of public safety, ordered by population descending? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Mult...
what are the names of the counties of public safety, ordered by population descending?
county_public_safety
select distinct police_force from county_public_safety where location != 'east'
Question: list the distinct police forces of counties whose location is not on east side. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial...
list the distinct police forces of counties whose location is not on east side.
county_public_safety
select distinct police_force from county_public_safety where location != 'east'
Question: what are the different police forces of counties that are not located in the east? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multirac...
what are the different police forces of counties that are not located in the east?
county_public_safety
select min(crime_rate) , max(crime_rate) from county_public_safety
Question: what are the minimum and maximum crime rate of counties? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: ci...
what are the minimum and maximum crime rate of counties?
county_public_safety
select min(crime_rate) , max(crime_rate) from county_public_safety
Question: return the minimum and maximum crime rates across all counties. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Jo...
return the minimum and maximum crime rates across all counties.
county_public_safety
select crime_rate from county_public_safety order by police_officers asc
Question: show the crime rates of counties in ascending order of number of police officers. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiraci...
show the crime rates of counties in ascending order of number of police officers.
county_public_safety
select crime_rate from county_public_safety order by police_officers asc
Question: what are the crime rates of counties sorted by number of offices ascending? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hi...
what are the crime rates of counties sorted by number of offices ascending?
county_public_safety
select name from city order by name asc
Question: what are the names of cities in ascending alphabetical order? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Join...
what are the names of cities in ascending alphabetical order?
county_public_safety
select name from city order by name asc
Question: return the names of cities, ordered alphabetically. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.Co...
return the names of cities, ordered alphabetically.
county_public_safety
select hispanic from city where black > 10
Question: what are the percentage of hispanics in cities with the black percentage higher than 10? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Mu...
what are the percentage of hispanics in cities with the black percentage higher than 10?
county_public_safety
select hispanic from city where black > 10
Question: return the hispanic percentage for cities in which the black percentage is greater than 10. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian,...
return the hispanic percentage for cities in which the black percentage is greater than 10.
county_public_safety
select name from county_public_safety order by population desc limit 1
Question: list the name of the county with the largest population. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: ci...
list the name of the county with the largest population.
county_public_safety
select name from county_public_safety order by population desc limit 1
Question: what is the name of the county with the greatest population? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins...
what is the name of the county with the greatest population?
county_public_safety
select name from city order by white desc limit 5
Question: list the names of the city with the top 5 white percentages. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins...
list the names of the city with the top 5 white percentages.
county_public_safety
select name from city order by white desc limit 5
Question: what are the names of the five cities with the greatest proportion of white people? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multira...
what are the names of the five cities with the greatest proportion of white people?
county_public_safety
select t1.name , t2.name from city as t1 join county_public_safety as t2 on t1.county_id = t2.county_id
Question: show names of cities and names of counties they are in. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: cit...
show names of cities and names of counties they are in.
county_public_safety
select t1.name , t2.name from city as t1 join county_public_safety as t2 on t1.county_id = t2.county_id
Question: what are the names of cities, as well as the names of the counties they correspond to? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Mult...
what are the names of cities, as well as the names of the counties they correspond to?
county_public_safety
select t1.white , t2.crime_rate from city as t1 join county_public_safety as t2 on t1.county_id = t2.county_id
Question: show white percentages of cities and the crime rates of counties they are in. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, ...
show white percentages of cities and the crime rates of counties they are in.
county_public_safety
select t1.white , t2.crime_rate from city as t1 join county_public_safety as t2 on t1.county_id = t2.county_id
Question: what are the white percentages of cities, and the corresponding crime rates of the counties they correspond to? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black...
what are the white percentages of cities, and the corresponding crime rates of the counties they correspond to?
county_public_safety
select name from city where county_id = (select county_id from county_public_safety order by police_officers desc limit 1)
Question: show the name of cities in the county that has the largest number of police officers. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multi...
show the name of cities in the county that has the largest number of police officers.
county_public_safety
select name from city where county_id = (select county_id from county_public_safety order by police_officers desc limit 1)
Question: what are the names of cities that are in the county with the most police officers? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multirac...
what are the names of cities that are in the county with the most police officers?
county_public_safety
select count(*) from city where county_id in (select county_id from county_public_safety where population > 20000)
Question: show the number of cities in counties that have a population more than 20000. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, ...
show the number of cities in counties that have a population more than 20000.
county_public_safety
select count(*) from city where county_id in (select county_id from county_public_safety where population > 20000)
Question: how many cities are in counties that have populations of over 20000? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic....
how many cities are in counties that have populations of over 20000?
county_public_safety
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
Question: show the crime rate of counties with a city having white percentage more than 90. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiraci...
show the crime rate of counties with a city having white percentage more than 90.
county_public_safety
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
Question: what are the crime rates of counties that contain cities that have white percentages of over 90? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, A...
what are the crime rates of counties that contain cities that have white percentages of over 90?
county_public_safety
select police_force , count(*) from county_public_safety group by police_force
Question: please show the police forces and the number of counties with each police force. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracia...
please show the police forces and the number of counties with each police force.
county_public_safety
select police_force , count(*) from county_public_safety group by police_force
Question: how many counties correspond to each police force? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.Cou...
how many counties correspond to each police force?
county_public_safety
select location from county_public_safety group by location order by count(*) desc limit 1
Question: what is the location shared by most counties? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.County_I...
what is the location shared by most counties?
county_public_safety
select location from county_public_safety group by location order by count(*) desc limit 1
Question: which location has the most corresponding counties? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: city.Co...
which location has the most corresponding counties?
county_public_safety
select name from county_public_safety where county_id not in (select county_id from city)
Question: list the names of counties that do not have any cities. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joins: cit...
list the names of counties that do not have any cities.
county_public_safety
select name from county_public_safety where county_id not in (select county_id from city)
Question: what are the names of counties that do not contain any cities? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. | Joi...
what are the names of counties that do not contain any cities?
county_public_safety
select police_force from county_public_safety where location = 'east' intersect select police_force from county_public_safety where location = 'west'
Question: show the police force shared by counties with location on the east and west. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, H...
show the police force shared by counties with location on the east and west.
county_public_safety
select police_force from county_public_safety where location = 'east' intersect select police_force from county_public_safety where location = 'west'
Question: which police forces operate in both counties that are located in the east and in the west? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, ...
which police forces operate in both counties that are located in the east and in the west?
county_public_safety
select name from city where county_id in (select county_id from county_public_safety where crime_rate < 100)
Question: show the names of cities in counties that have a crime rate less than 100. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, His...
show the names of cities in counties that have a crime rate less than 100.
county_public_safety
select name from city where county_id in (select county_id from county_public_safety where crime_rate < 100)
Question: what are the names of cities that are in counties that have a crime rate below 100? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multira...
what are the names of cities that are in counties that have a crime rate below 100?
county_public_safety
select case_burden from county_public_safety order by population desc
Question: show the case burden of counties in descending order of population. | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispanic. ...
show the case burden of counties in descending order of population.
county_public_safety
select case_burden from county_public_safety order by population desc
Question: what are the case burdens of counties, ordered descending by population? | Tables: county_public_safety -> County_ID, Name, Population, Police_officers, Residents_per_officer, Case_burden, Crime_rate, Police_force, Location. city -> City_ID, County_ID, Name, White, Black, Amerindian, Asian, Multiracial, Hispa...
what are the case burdens of counties, ordered descending by population?
inn_1
select roomname from rooms where baseprice < 160 and beds = 2 and decor = 'modern';
Question: find the names of all modern rooms with a base price below $160 and two beds. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
find the names of all modern rooms with a base price below $160 and two beds.
inn_1
select roomname from rooms where baseprice < 160 and beds = 2 and decor = 'modern';
Question: what are the names of modern rooms that have a base price lower than $160 and two beds. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what are the names of modern rooms that have a base price lower than $160 and two beds.
inn_1
select roomname , roomid from rooms where baseprice > 160 and maxoccupancy > 2;
Question: find all the rooms that have a price higher than 160 and can accommodate more than 2 people. report room names and ids. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservati...
find all the rooms that have a price higher than 160 and can accommodate more than 2 people. report room names and ids.
inn_1
select roomname , roomid from rooms where baseprice > 160 and maxoccupancy > 2;
Question: what are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.R...
what are the room names and ids of all the rooms that cost more than 160 and can accommodate more than two people.
inn_1
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;
Question: find the most popular room in the hotel. the most popular room is the room that had seen the largest number of reservations. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Rese...
find the most popular room in the hotel. the most popular room is the room that had seen the largest number of reservations.
inn_1
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;
Question: which room has the largest number of reservations? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
which room has the largest number of reservations?
inn_1
select kids from reservations where firstname = 'roy' and lastname = 'sweazy';
Question: how many kids stay in the rooms reserved by roy sweazy? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many kids stay in the rooms reserved by roy sweazy?
inn_1
select kids from reservations where firstname = 'roy' and lastname = 'sweazy';
Question: find the number of kids staying in the rooms reserved by a person called roy sweaz. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
find the number of kids staying in the rooms reserved by a person called roy sweaz.
inn_1
select count(*) from reservations where firstname = 'roy' and lastname = 'sweazy';
Question: how many times does roy sweazy has reserved a room. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many times does roy sweazy has reserved a room.
inn_1
select count(*) from reservations where firstname = 'roy' and lastname = 'sweazy';
Question: find the number of times roy sweazy has reserved a room. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
find the number of times roy sweazy has reserved a room.
inn_1
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;
Question: which room has the highest rate? list the room's full name, rate, check in and check out date. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
which room has the highest rate? list the room's full name, rate, check in and check out date.
inn_1
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;
Question: return the name, rate, check in and check out date for the room with the highest rate. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
return the name, rate, check in and check out date for the room with the highest rate.
inn_1
select adults from reservations where checkin = '2010-10-23' and firstname = 'conrad' and lastname = 'selbig';
Question: how many adults stay in the room conrad selbig checked in on oct 23, 2010? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many adults stay in the room conrad selbig checked in on oct 23, 2010?
inn_1
select adults from reservations where checkin = '2010-10-23' and firstname = 'conrad' and lastname = 'selbig';
Question: find the number of adults for the room reserved and checked in by conrad selbig on oct 23, 2010. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId...
find the number of adults for the room reserved and checked in by conrad selbig on oct 23, 2010.
inn_1
select kids from reservations where checkin = '2010-09-21' and firstname = 'damien' and lastname = 'trachsel';
Question: how many kids stay in the room damien trachsel checked in on sep 21, 2010? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many kids stay in the room damien trachsel checked in on sep 21, 2010?
inn_1
select kids from reservations where checkin = '2010-09-21' and firstname = 'damien' and lastname = 'trachsel';
Question: return the number of kids for the room reserved and checked in by damien trachsel on sep 21, 2010. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.Roo...
return the number of kids for the room reserved and checked in by damien trachsel on sep 21, 2010.
inn_1
select sum(beds) from rooms where bedtype = 'king';
Question: how many king beds are there? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many king beds are there?
inn_1
select sum(beds) from rooms where bedtype = 'king';
Question: find the total number of king beds available. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
find the total number of king beds available.
inn_1
select roomname , decor from rooms where bedtype = 'king' order by baseprice;
Question: list the names and decor of rooms that have a king bed. sort the list by their price. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
list the names and decor of rooms that have a king bed. sort the list by their price.
inn_1
select roomname , decor from rooms where bedtype = 'king' order by baseprice;
Question: what are the names and decor of rooms with a king bed? sort them by their price | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what are the names and decor of rooms with a king bed? sort them by their price
inn_1
select roomname , baseprice from rooms order by baseprice asc limit 1;
Question: which room has cheapest base price? list the room's name and the base price. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
which room has cheapest base price? list the room's name and the base price.
inn_1
select roomname , baseprice from rooms order by baseprice asc limit 1;
Question: what are the room name and base price of the room with the lowest base price? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what are the room name and base price of the room with the lowest base price?
inn_1
select decor from rooms where roomname = 'recluse and defiance';
Question: what is the decor of room recluse and defiance? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what is the decor of room recluse and defiance?
inn_1
select decor from rooms where roomname = 'recluse and defiance';
Question: return the decor of the room named 'recluse and defiance'. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
return the decor of the room named 'recluse and defiance'.
inn_1
select bedtype , avg(baseprice) from rooms group by bedtype;
Question: what is the average base price of different bed type? list bed type and average base price. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what is the average base price of different bed type? list bed type and average base price.
inn_1
select bedtype , avg(baseprice) from rooms group by bedtype;
Question: for each bed type, find the average base price of different bed type. | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
for each bed type, find the average base price of different bed type.
inn_1
select sum(maxoccupancy) from rooms where decor = 'modern';
Question: what is the total number of people who could stay in the modern rooms in this inn? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
what is the total number of people who could stay in the modern rooms in this inn?
inn_1
select sum(maxoccupancy) from rooms where decor = 'modern';
Question: how many people in total can stay in the modern rooms of this inn? | Tables: Rooms -> RoomId, roomName, beds, bedType, maxOccupancy, basePrice, decor. Reservations -> Code, Room, CheckIn, CheckOut, Rate, LastName, FirstName, Adults, Kids. | Joins: Reservations.Room = Rooms.RoomId,
how many people in total can stay in the modern rooms of this inn?