richardr1126/spider-context-instruct huggingface dataset:
### Instruction:

Convert text to sql: For each director, what is the title and score of their most poorly rated movie? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title , rating.stars , movie.director , min ( rating.stars ) from rating join movie on rating.mid = movie.mid group by movie.director

### Instruction:

Convert text to sql: What is the name of the movie that is rated by most of times? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title , rating.mid from rating join movie on rating.mid = movie.mid group by rating.mid order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: What is the name of the movie that has been reviewed the most? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title , rating.mid from rating join movie on rating.mid = movie.mid group by rating.mid order by count ( * ) desc limit 1

### Instruction:

Convert text to sql: What are the titles of all movies that have rating star is between 3 and 5? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title from rating join movie on rating.mid = movie.mid where rating.stars between 3 and 5

### Instruction:

Convert text to sql: What are the titles of all movies that have between 3 and 5 stars? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title from rating join movie on rating.mid = movie.mid where rating.stars between 3 and 5

### Instruction:

Convert text to sql: Find the names of reviewers who had given higher than 3 star ratings. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars > 3

### Instruction:

Convert text to sql: What are the names of the reviewers who have rated a movie more than 3 stars before? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars > 3
### Instruction:

Convert text to sql: Find the average rating star for each movie that are not reviewed by Brittany Harris. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid , avg ( stars ) from rating where mid not in ( select rating.mid from rating join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris' ) group by mid

### Instruction:

Convert text to sql: What is the average rating for each movie that has never been reviewed by Brittany Harris? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid , avg ( stars ) from rating where mid not in ( select rating.mid from rating join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris' ) group by mid

### Instruction:

Convert text to sql: What are the ids of the movies that are not reviewed by Brittany Harris. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid from rating except select rating.mid from rating join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris'

### Instruction:

Convert text to sql: What are the ids of all moviest hat have not been reviewed by Britanny Harris? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid from rating except select rating.mid from rating join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris'

### Instruction:

Convert text to sql: Find the average rating star for each movie that received at least 2 ratings. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid , avg ( stars ) from rating group by mid having count ( * ) >= 2

### Instruction:

Convert text to sql: For each movie that received more than 3 reviews, what is the average rating? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select mid , avg ( stars ) from rating group by mid having count ( * ) >= 2

### Instruction:

Convert text to sql: find the ids of reviewers who did not give 4 star. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select rid from rating except select rid from rating where stars = 4
### Instruction:

Convert text to sql: What are the ids of all reviewers who did not give 4 stars? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select rid from rating except select rid from rating where stars = 4

### Instruction:

Convert text to sql: Find the ids of reviewers who didn't only give 4 star. | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select rid from rating where stars != 4

### Instruction:

Convert text to sql: What are the ids of all reviewers who have not given 4 stars at least once? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select rid from rating where stars != 4

### Instruction:

Convert text to sql: What are names of the movies that are either made after 2000 or reviewed by Brittany Harris? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select distinct movie.title from rating join movie on rating.mid = movie.mid join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris' or movie.year > 2000

### Instruction:

Convert text to sql: What are the names of all movies that were made after 2000 or reviewed by Brittany Harris? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select distinct movie.title from rating join movie on rating.mid = movie.mid join reviewer on rating.rid = reviewer.rid where reviewer.name = 'Brittany Harris' or movie.year > 2000

### Instruction:

Convert text to sql: What are names of the movies that are either made before 1980 or directed by James Cameron? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select title from movie where director = 'James Cameron' or year < 1980

### Instruction:

Convert text to sql: What are the names of all movies made before 1980 or had James Cameron as the director? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select title from movie where director = 'James Cameron' or year < 1980
### Instruction:

Convert text to sql: What are the names of reviewers who had rated 3 star and 4 star? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars = 3 intersect select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars = 4

### Instruction:

Convert text to sql: What are the names of all reviewers that have given 3 or 4 stars for reviews? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars = 3 intersect select reviewer.name from rating join reviewer on rating.rid = reviewer.rid where rating.stars = 4

### Instruction:

Convert text to sql: What are the names of movies that get 3 star and 4 star? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title from rating join movie on rating.mid = movie.mid where rating.stars = 3 intersect select movie.title from rating join movie on rating.mid = movie.mid where rating.stars = 4

### Instruction:

Convert text to sql: What are the names of all movies that received 3 or 4 stars? | movie : mid , title , year , director | reviewer : rid , name | rating : rid , mid , stars , ratingdate | rating.rid = reviewer.rid | rating.mid = movie.mid | 

### Response:

select movie.title from rating join movie on rating.mid = movie.mid where rating.stars = 3 intersect select movie.title from rating join movie on rating.mid = movie.mid where rating.stars = 4
### Instruction:

Convert text to sql: How many counties are there? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select count ( * ) from county_public_safety

### Instruction:

Convert text to sql: Count the number of countries. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select count ( * ) from county_public_safety

### Instruction:

Convert text to sql: List the names of counties in descending order of population. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from county_public_safety order by population desc

### Instruction:

Convert text to sql: What are the names of the counties of public safety, ordered by population descending? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from county_public_safety order by population desc

### Instruction:

Convert text to sql: List the distinct police forces of counties whose location is not on east side. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select distinct police_force from county_public_safety where location != 'East'

### Instruction:

Convert text to sql: What are the different police forces of counties that are not located in the East? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select distinct police_force from county_public_safety where location != 'East'
### Instruction:

Convert text to sql: What are the minimum and maximum crime rate of counties? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select min ( crime_rate ) , max ( crime_rate ) from county_public_safety

### Instruction:

Convert text to sql: Return the minimum and maximum crime rates across all counties. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select min ( crime_rate ) , max ( crime_rate ) from county_public_safety

### Instruction:

Convert text to sql: Show the crime rates of counties in ascending order of number of police officers. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select crime_rate from county_public_safety order by police_officers asc

### Instruction:

Convert text to sql: What are the crime rates of counties sorted by number of offices ascending? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select crime_rate from county_public_safety order by police_officers asc

### Instruction:

Convert text to sql: What are the names of cities in ascending alphabetical order? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from city order by name asc

### Instruction:

Convert text to sql: Return the names of cities, ordered alphabetically. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from city order by name asc
### Instruction:

Convert text to sql: What are the percentage of hispanics in cities with the black percentage higher than 10? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select hispanic from city where black > 10

### Instruction:

Convert text to sql: Return the hispanic percentage for cities in which the black percentage is greater than 10. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select hispanic from city where black > 10

### Instruction:

Convert text to sql: List the name of the county with the largest population. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from county_public_safety order by population desc limit 1

### Instruction:

Convert text to sql: What is the name of the county with the greatest population? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from county_public_safety order by population desc limit 1

### Instruction:

Convert text to sql: List the names of the city with the top 5 white percentages. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from city order by white desc limit 5

### Instruction:

Convert text to sql: What are the names of the five cities with the greatest proportion of white people? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from city order by white desc limit 5
### Instruction:

Convert text to sql: Show names of cities and names of counties they are in. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select city.name , county_public_safety.name from city join county_public_safety on city.county_id = county_public_safety.county_id

### Instruction:

Convert text to sql: What are the names of cities, as well as the names of the counties they correspond to? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select city.name , county_public_safety.name from city join county_public_safety on city.county_id = county_public_safety.county_id

### Instruction:

Convert text to sql: Show white percentages of cities and the crime rates of counties they are in. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select city.white , county_public_safety.crime_rate from city join county_public_safety on city.county_id = county_public_safety.county_id

### Instruction:

Convert text to sql: What are the white percentages of cities, and the corresponding crime rates of the counties they correspond to? | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select city.white , county_public_safety.crime_rate from city join county_public_safety on city.county_id = county_public_safety.county_id

### Instruction:

Convert text to sql: Show the name of cities in the county that has the largest number of police officers. | 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 | city.county_id = county_public_safety.county_id | 

### Response:

select name from city where county_id = ( select county_id from county_public_safety order by police_officers desc limit 1 )