Question:
What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies?
Additional table information: table: movie_1

Answer: SELECT T1.director, T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5


Question:
What is the average rating star for each reviewer?
Additional table information: table: movie_1

Answer: SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name


Question:
What is the average number of stars that each reviewer awards for a movie?
Additional table information: table: movie_1

Answer: SELECT T2.name, AVG(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name


Question:
Find the titles of all movies that have no ratings.
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating)


Question:
What are the titles of all movies that have not been rated?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE NOT mID IN (SELECT mID FROM Rating)


Question:
Find the names of all reviewers who have ratings with a NULL value for the date.
Additional table information: table: movie_1

Answer: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = 'null'


Question:
What are the different names of all reviewers whose ratings do not have a date field?
Additional table information: table: movie_1

Answer: SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = 'null'


Question:
What is the average rating stars and title for the oldest movie?
Additional table information: table: movie_1

Answer: SELECT AVG(T1.stars), T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MIN(YEAR) FROM Movie)


Question:
For the oldest movie listed, what is its average rating and title?
Additional table information: table: movie_1

Answer: SELECT AVG(T1.stars), T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MIN(YEAR) FROM Movie)


Question:
What is the name of the most recent movie?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie)


Question:
What is the title of the newest movie?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE YEAR = (SELECT MAX(YEAR) FROM Movie)


Question:
What is the maximum stars and year for the most recent movie?
Additional table information: table: movie_1

Answer: SELECT MAX(T1.stars), T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MAX(YEAR) FROM Movie)


Question:
What is highest rating for the most recent movie and when was it released?
Additional table information: table: movie_1

Answer: SELECT MAX(T1.stars), T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.year = (SELECT MAX(YEAR) FROM Movie)


Question:
What is the names of movies whose created year is after all movies directed by Steven Spielberg?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = 'Steven Spielberg')


Question:
What are the names of all movies that were created after the most recent Steven Spielberg film?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE YEAR > (SELECT MAX(YEAR) FROM Movie WHERE director = 'Steven Spielberg')


Question:
What are the titles and directors of the movies whose star is greater than the average stars of the movies directed by James Cameron?
Additional table information: table: movie_1

Answer: SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron')


Question:
What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating?
Additional table information: table: movie_1

Answer: SELECT T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars > (SELECT AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T2.director = 'James Cameron')


Question:
Return reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly by number of stars.
Additional table information: table: movie_1

Answer: SELECT T3.name, T2.title, T1.stars, T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name NULLS FIRST, T2.title NULLS FIRST, T1.stars NULLS FIRST


Question:
What is the reviewer name, film title, movie rating, and rating date  for every movie ordered by reviewer name, movie title, then finally rating?
Additional table information: table: movie_1

Answer: SELECT T3.name, T2.title, T1.stars, T1.ratingDate FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID ORDER BY T3.name NULLS FIRST, T2.title NULLS FIRST, T1.stars NULLS FIRST


Question:
Find the names of all reviewers who have contributed three or more ratings.
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3


Question:
What are the names of all reviewers that have rated 3 or more movies?
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3


Question:
Find the names of all reviewers who rated Gone with the Wind.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'


Question:
What are the names of all the different reviewers who rates Gone with the Wind?
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.title = 'Gone with the Wind'


Question:
Find the names of all directors whose movies are rated by Sarah Martinez.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T2.director 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 = 'Sarah Martinez'


Question:
What are the names of all directors whose movies have been reviewed by Sarah Martinez?
Additional table information: table: movie_1

Answer: SELECT DISTINCT T2.director 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 = 'Sarah Martinez'


Question:
For any rating where the name of reviewer is the same as the director of the movie, return the reviewer name, movie title, and number of stars.
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name


Question:
What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director?
Additional table information: table: movie_1

Answer: SELECT DISTINCT T3.name, T2.title, T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID JOIN Reviewer AS T3 ON T1.rID = T3.rID WHERE T2.director = T3.name


Question:
Return all reviewer names and movie names together in a single list.
Additional table information: table: movie_1

Answer: SELECT name FROM Reviewer UNION SELECT title FROM Movie


Question:
What are the names of all the reviewers and movie names?
Additional table information: table: movie_1

Answer: SELECT name FROM Reviewer UNION SELECT title FROM Movie


Question:
Find the titles of all movies not reviewed by Chris Jackson.
Additional table information: table: movie_1

Answer: SELECT DISTINCT title FROM Movie EXCEPT SELECT 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 = 'Chris Jackson'


Question:
What are the titles of all movies that were not reviewed by Chris Jackson?
Additional table information: table: movie_1

Answer: SELECT DISTINCT title FROM Movie EXCEPT SELECT 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 = 'Chris Jackson'


Question:
For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. Sort by director name, then movie title.
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title ORDER BY T1.director NULLS FIRST, T1.title NULLS FIRST


Question:
For all directors who have directed more than one movie, what movies have they directed and what are their names?
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.director FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title ORDER BY T1.director NULLS FIRST, T1.title NULLS FIRST


Question:
For directors who had more than one movie, return the titles and produced years of all movies directed by them.
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title


Question:
For each director who directed more than one movie, what are the titles and dates of release for all those movies?
Additional table information: table: movie_1

Answer: SELECT T1.title, T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title <> T2.title


Question:
What are the names of the directors who made exactly one movie?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1


Question:
What are the names of all directors who made one movie?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie GROUP BY director HAVING COUNT(*) = 1


Question:
What are the names of the directors who made exactly one movie excluding director NULL?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie WHERE director <> 'null' GROUP BY director HAVING COUNT(*) = 1


Question:
What are the names of all directors who have made one movie except for the director named NULL?
Additional table information: table: movie_1

Answer: SELECT director FROM Movie WHERE director <> 'null' GROUP BY director HAVING COUNT(*) = 1


Question:
How many movie reviews does each director get?
Additional table information: table: movie_1

Answer: SELECT COUNT(*), T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director


Question:
For each director, how many reviews have they received?
Additional table information: table: movie_1

Answer: SELECT COUNT(*), T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director


Question:
Find the movies with the highest average rating. Return the movie titles and average rating.
Additional table information: table: movie_1

Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) DESC LIMIT 1


Question:
What are the movie titles with the highest average rating and what are those ratings?
Additional table information: table: movie_1

Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) DESC LIMIT 1


Question:
What are the movie titles and average rating of the movies with the lowest average rating?
Additional table information: table: movie_1

Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) NULLS FIRST LIMIT 1


Question:
What are the titles and average ratings for all movies that have the lowest average rating?
Additional table information: table: movie_1

Answer: SELECT T2.title, AVG(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID GROUP BY T1.mID ORDER BY AVG(T1.stars) NULLS FIRST LIMIT 1


Question:
What are the names and years of the movies that has the top 3 highest rating star?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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:
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.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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:
Find the title and star rating of the movie that got the least rating star for each reviewer.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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 score of the movie with the lowest rating among all movies directed by each director.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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:
What is the name of the movie that is rated by most of times?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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 are the titles of all movies that have rating star is between 3 and 5?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID = T2.mID WHERE T1.stars BETWEEN 3 AND 5


Question:
Find the names of reviewers who had given higher than 3 star ratings.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID WHERE T1.stars > 3


Question:
Find the average rating star for each movie that are not reviewed by Brittany Harris.
Additional table information: table: movie_1

Answer: SELECT mID, AVG(stars) FROM Rating WHERE NOT mID 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?
Additional table information: table: movie_1

Answer: SELECT mID, AVG(stars) FROM Rating WHERE NOT mID 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 are the ids of the movies that are not reviewed by Brittany Harris.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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:
Find the average rating star for each movie that received at least 2 ratings.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: SELECT mID, AVG(stars) FROM Rating GROUP BY mID HAVING COUNT(*) >= 2


Question:
find the ids of reviewers who did not give 4 star.
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars = 4


Question:
Find the ids of reviewers who didn't only give 4 star.
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating WHERE stars <> 4


Question:
What are the ids of all reviewers who have not given 4 stars at least once?
Additional table information: table: movie_1

Answer: SELECT rID FROM Rating WHERE stars <> 4


Question:
What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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 before 1980 or directed by James Cameron?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: SELECT title FROM Movie WHERE director = 'James Cameron' OR YEAR < 1980


Question:
What are the names of reviewers who had rated 3 star and 4 star?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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 movies that get 3 star and 4 star?
Additional table information: table: movie_1

Answer: 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?
Additional table information: table: movie_1

Answer: 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:
How many counties are there?
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM county_public_safety


Question:
Count the number of countries.
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM county_public_safety


Question:
List the names of counties in descending order of population.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC


Question:
List the distinct police forces of counties whose location is not on east side.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT DISTINCT Police_force FROM county_public_safety WHERE LOCATION <> 'East'


Question:
What are the minimum and maximum crime rate of counties?
Additional table information: table: county_public_safety

Answer: SELECT MIN(Crime_rate), MAX(Crime_rate) FROM county_public_safety


Question:
Return the minimum and maximum crime rates across all counties.
Additional table information: table: county_public_safety

Answer: SELECT MIN(Crime_rate), MAX(Crime_rate) FROM county_public_safety


Question:
Show the crime rates of counties in ascending order of number of police officers.
Additional table information: table: county_public_safety

Answer: SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC NULLS FIRST


Question:
What are the crime rates of counties sorted by number of offices ascending?
Additional table information: table: county_public_safety

Answer: SELECT Crime_rate FROM county_public_safety ORDER BY Police_officers ASC NULLS FIRST


Question:
What are the names of cities in ascending alphabetical order?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM city ORDER BY Name ASC NULLS FIRST


Question:
Return the names of cities, ordered alphabetically.
Additional table information: table: county_public_safety

Answer: SELECT Name FROM city ORDER BY Name ASC NULLS FIRST


Question:
What are the percentage of hispanics in cities with the black percentage higher than 10?
Additional table information: table: county_public_safety

Answer: SELECT Hispanic FROM city WHERE Black > 10


Question:
Return the hispanic percentage for cities in which the black percentage is greater than 10.
Additional table information: table: county_public_safety

Answer: SELECT Hispanic FROM city WHERE Black > 10


Question:
List the name of the county with the largest population.
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1


Question:
What is the name of the county with the greatest population?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety ORDER BY Population DESC LIMIT 1


Question:
List the names of the city with the top 5 white percentages.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM city ORDER BY White DESC LIMIT 5


Question:
Show names of cities and names of counties they are in.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT T1.Name, T2.Name 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.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: 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 the name of cities in the county that has the largest number of police officers.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT name FROM city WHERE county_ID = (SELECT county_ID FROM county_public_safety ORDER BY Police_officers DESC LIMIT 1)


Question:
Show the number of cities in counties that have a population more than 20000.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT COUNT(*) FROM city WHERE county_ID IN (SELECT county_ID FROM county_public_safety WHERE population > 20000)


Question:
Show the crime rate of counties with a city having white percentage more than 90.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: 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:
Please show the police forces and the number of counties with each police force.
Additional table information: table: county_public_safety

Answer: SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force


Question:
How many counties correspond to each police force?
Additional table information: table: county_public_safety

Answer: SELECT Police_force, COUNT(*) FROM county_public_safety GROUP BY Police_force


Question:
What is the location shared by most counties?
Additional table information: table: county_public_safety

Answer: SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which location has the most corresponding counties?
Additional table information: table: county_public_safety

Answer: SELECT LOCATION FROM county_public_safety GROUP BY LOCATION ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the names of counties that do not have any cities.
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety WHERE NOT County_ID IN (SELECT County_ID FROM city)


Question:
What are the names of counties that do not contain any cities?
Additional table information: table: county_public_safety

Answer: SELECT Name FROM county_public_safety WHERE NOT County_ID IN (SELECT County_ID FROM city)


Question:
Show the police force shared by counties with location on the east and west.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT Police_force FROM county_public_safety WHERE LOCATION = 'East' INTERSECT SELECT Police_force FROM county_public_safety WHERE LOCATION = 'West'


Question:
Show the names of cities in counties that have a crime rate less than 100.
Additional table information: table: county_public_safety

Answer: 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?
Additional table information: table: county_public_safety

Answer: SELECT name FROM city WHERE county_id IN (SELECT county_id FROM county_public_safety WHERE Crime_rate < 100)


Question:
Show the case burden of counties in descending order of population.
Additional table information: table: county_public_safety

Answer: SELECT Case_burden FROM county_public_safety ORDER BY Population DESC


Question:
What are the case burdens of counties, ordered descending by population?
Additional table information: table: county_public_safety

Answer: SELECT Case_burden FROM county_public_safety ORDER BY Population DESC


Question:
Find the names of all modern rooms with a base price below $160 and two beds.
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice < 160 AND beds = 2 AND decor = 'modern'


Question:
Find all the rooms that have a price higher than 160 and can accommodate more than 2 people. Report room names and ids.
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: SELECT roomName, RoomId FROM Rooms WHERE basePrice > 160 AND maxOccupancy > 2


Question:
Find the most popular room in the hotel. The most popular room is the room that had seen the largest number of reservations.
Additional table information: table: inn_1

Answer: 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?
Additional table information: table: inn_1

Answer: 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:
How many kids stay in the rooms reserved by ROY SWEAZY?
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: SELECT kids FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
How many times does ROY SWEAZY has reserved a room.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
Find the number of times ROY SWEAZY has reserved a room.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations WHERE FirstName = 'ROY' AND LastName = 'SWEAZY'


Question:
Which room has the highest rate? List the room's full name, rate, check in and check out date.
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: 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:
How many adults stay in the room CONRAD SELBIG checked in on Oct 23, 2010?
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: SELECT Adults FROM Reservations WHERE CheckIn = '2010-10-23' AND FirstName = 'CONRAD' AND LastName = 'SELBIG'


Question:
How many kids stay in the room DAMIEN TRACHSEL checked in on Sep 21, 2010?
Additional table information: table: inn_1

Answer: 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.
Additional table information: table: inn_1

Answer: SELECT Kids FROM Reservations WHERE CheckIn = '2010-09-21' AND FirstName = 'DAMIEN' AND LastName = 'TRACHSEL'


Question:
How many king beds are there?
Additional table information: table: inn_1

Answer: SELECT SUM(beds) FROM Rooms WHERE bedtype = 'King'


Question:
Find the total number of king beds available.
Additional table information: table: inn_1

Answer: SELECT SUM(beds) FROM Rooms WHERE bedtype = 'King'


Question:
List the names and decor of rooms that have a king bed. Sort the list by their price.
Additional table information: table: inn_1

Answer: SELECT roomName, decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice NULLS FIRST


Question:
What are the names and decor of rooms with a king bed? Sort them by their price
Additional table information: table: inn_1

Answer: SELECT roomName, decor FROM Rooms WHERE bedtype = 'King' ORDER BY basePrice NULLS FIRST


Question:
Which room has cheapest base price? List the room's name and the base price.
Additional table information: table: inn_1

Answer: SELECT roomName, basePrice FROM Rooms ORDER BY basePrice ASC NULLS FIRST LIMIT 1


Question:
What are the room name and base price of the room with the lowest base price?
Additional table information: table: inn_1

Answer: SELECT roomName, basePrice FROM Rooms ORDER BY basePrice ASC NULLS FIRST LIMIT 1


Question:
What is the decor of room Recluse and defiance?
Additional table information: table: inn_1

Answer: SELECT decor FROM Rooms WHERE roomName = 'Recluse and defiance'


Question:
Return the decor of the room named 'Recluse and defiance'.
Additional table information: table: inn_1

Answer: SELECT decor FROM Rooms WHERE roomName = 'Recluse and defiance'


Question:
What is the average base price of different bed type? List bed type and average base price.
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
For each bed type, find the average base price of different bed type.
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
What is the total number of people who could stay in the modern rooms in this inn?
Additional table information: table: inn_1

Answer: SELECT SUM(maxOccupancy) FROM Rooms WHERE decor = 'modern'


Question:
How many people in total can stay in the modern rooms of this inn?
Additional table information: table: inn_1

Answer: SELECT SUM(maxOccupancy) FROM Rooms WHERE decor = 'modern'


Question:
What kind of decor has the least number of reservations?
Additional table information: table: inn_1

Answer: SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) ASC NULLS FIRST LIMIT 1


Question:
What is the least popular kind of decor?
Additional table information: table: inn_1

Answer: SELECT T2.decor FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T2.decor ORDER BY COUNT(T2.decor) ASC NULLS FIRST LIMIT 1


Question:
List how many times the number of people in the room reached the maximum occupancy of the room. The number of people include adults and kids.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids


Question:
How many times the number of adults and kids staying in a room reached the maximum capacity of the room?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T2.maxOccupancy = T1.Adults + T1.Kids


Question:
Find the first and last names of people who payed more than the rooms' base prices.
Additional table information: table: inn_1

Answer: SELECT T1.firstname, T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0


Question:
What are the first and last names of people who payed more than the rooms' base prices?
Additional table information: table: inn_1

Answer: SELECT T1.firstname, T1.lastname FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE T1.Rate - T2.basePrice > 0


Question:
How many rooms are there?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms


Question:
What is the total number of rooms available in this inn?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms


Question:
Find the number of rooms with a king bed.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms WHERE bedType = 'King'


Question:
How many rooms have a king bed?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM Rooms WHERE bedType = 'King'


Question:
Find the number of rooms for each bed type.
Additional table information: table: inn_1

Answer: SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType


Question:
What are the number of rooms for each bed type?
Additional table information: table: inn_1

Answer: SELECT bedType, COUNT(*) FROM Rooms GROUP BY bedType


Question:
Find the name of the room with the maximum occupancy.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1


Question:
What is the name of the room that can accommodate the most people?
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY maxOccupancy DESC LIMIT 1


Question:
Find the id and name of the most expensive base price room.
Additional table information: table: inn_1

Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1


Question:
Which room has the highest base price?
Additional table information: table: inn_1

Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 1


Question:
List the type of bed and name of all traditional rooms.
Additional table information: table: inn_1

Answer: SELECT roomName, bedType FROM Rooms WHERE decor = 'traditional'


Question:
What are the bed type and name of all the rooms with traditional decor?
Additional table information: table: inn_1

Answer: SELECT roomName, bedType FROM Rooms WHERE decor = 'traditional'


Question:
Find the number of rooms with king bed for each decor type.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE bedType = 'King' GROUP BY decor


Question:
How many rooms have king beds? Report the number for each decor type.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE bedType = 'King' GROUP BY decor


Question:
Find the average and minimum price of the rooms in different decor.
Additional table information: table: inn_1

Answer: SELECT decor, AVG(basePrice), MIN(basePrice) FROM Rooms GROUP BY decor


Question:
What is the average minimum and price of the rooms for each different decor.
Additional table information: table: inn_1

Answer: SELECT decor, AVG(basePrice), MIN(basePrice) FROM Rooms GROUP BY decor


Question:
List the name of all rooms sorted by their prices.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY basePrice NULLS FIRST


Question:
Sort all the rooms according to the price. Just report the room names.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms ORDER BY basePrice NULLS FIRST


Question:
Find the number of rooms with price higher than 120 for different decor.
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor


Question:
How many rooms cost more than 120, for each different decor?
Additional table information: table: inn_1

Answer: SELECT decor, COUNT(*) FROM Rooms WHERE basePrice > 120 GROUP BY decor


Question:
For each bed type, find the average room price.
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
What is the average base price of rooms, for each bed type?
Additional table information: table: inn_1

Answer: SELECT bedType, AVG(basePrice) FROM Rooms GROUP BY bedType


Question:
List the name of rooms with king or queen bed.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE bedType = 'King' OR bedType = 'Queen'


Question:
What are the names of rooms that have either king or queen bed?
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE bedType = 'King' OR bedType = 'Queen'


Question:
How many different types of beds are there?
Additional table information: table: inn_1

Answer: SELECT COUNT(DISTINCT bedType) FROM Rooms


Question:
Find the number of distinct bed types available in this inn.
Additional table information: table: inn_1

Answer: SELECT COUNT(DISTINCT bedType) FROM Rooms


Question:
Find the name and id of the top 3 expensive rooms.
Additional table information: table: inn_1

Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3


Question:
What are the name and id of the three highest priced rooms?
Additional table information: table: inn_1

Answer: SELECT RoomId, roomName FROM Rooms ORDER BY basePrice DESC LIMIT 3


Question:
Find the name of rooms whose price is higher than the average price.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice > (SELECT AVG(basePrice) FROM Rooms)


Question:
What are the name of rooms that cost more than the average.
Additional table information: table: inn_1

Answer: SELECT roomName FROM Rooms WHERE basePrice > (SELECT AVG(basePrice) FROM Rooms)


Question:
Find the number of rooms that do not have any reservation.
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM rooms WHERE NOT roomid IN (SELECT DISTINCT room FROM reservations)


Question:
How many rooms have not had any reservation yet?
Additional table information: table: inn_1

Answer: SELECT COUNT(*) FROM rooms WHERE NOT roomid IN (SELECT DISTINCT room FROM reservations)


Question:
Return the name and number of reservations made for each of the rooms.
Additional table information: table: inn_1

Answer: SELECT T2.roomName, COUNT(*), T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room


Question:
For each room, find its name and the number of times reservations were made for it.
Additional table information: table: inn_1

Answer: SELECT T2.roomName, COUNT(*), T1.Room FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room


Question:
Find the names of rooms that have been reserved for more than 60 times.
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING COUNT(*) > 60


Question:
What are the names of rooms whose reservation frequency exceeds 60 times?
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId GROUP BY T1.Room HAVING COUNT(*) > 60


Question:
Find the name of rooms whose base price is between 120 and 150.
Additional table information: table: inn_1

Answer: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150


Question:
Which rooms cost between 120 and 150? Give me the room names.
Additional table information: table: inn_1

Answer: SELECT roomname FROM rooms WHERE baseprice BETWEEN 120 AND 150


Question:
Find the name of rooms booked by some customers whose first name contains ROY.
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'


Question:
What are the name of rooms booked by customers whose first name has 'ROY' in part?
Additional table information: table: inn_1

Answer: SELECT T2.roomName FROM Reservations AS T1 JOIN Rooms AS T2 ON T1.Room = T2.RoomId WHERE firstname LIKE '%ROY%'


Question:
what are the details of the cmi masters that have the cross reference code 'Tax'?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.cmi_details FROM Customer_Master_Index AS T1 JOIN CMI_Cross_References AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T2.source_system_code = 'Tax'


Question:
What is the cmi cross reference id that is related to at least one council tax entry? List the cross reference id and source system code.
Additional table information: table: local_govt_mdm

Answer: SELECT T1.cmi_cross_ref_id, T1.source_system_code FROM CMI_Cross_References AS T1 JOIN Council_Tax AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T1.cmi_cross_ref_id HAVING COUNT(*) >= 1


Question:
How many business rates are related to each cmi cross reference? List cross reference id, master customer id and the n
Additional table information: table: local_govt_mdm

Answer: SELECT T2.cmi_cross_ref_id, T2.master_customer_id, COUNT(*) FROM Business_Rates AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id GROUP BY T2.cmi_cross_ref_id


Question:
What is the tax source system code related to the benefits and overpayments? List the code and the benifit id, order by benifit id.
Additional table information: table: local_govt_mdm

Answer: SELECT T1.source_system_code, T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Benefits_Overpayments AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id ORDER BY T2.council_tax_id NULLS FIRST


Question:
Wat is the tax source system code and master customer id of the taxes related to each parking fine id?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.source_system_code, T1.master_customer_id, T2.council_tax_id FROM CMI_Cross_References AS T1 JOIN Parking_Fines AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id


Question:
What are the renting arrears tax ids related to the customer master index whose detail is not 'Schmidt, Kertzmann and Lubowitz'?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.council_tax_id FROM Rent_Arrears AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id JOIN Customer_Master_Index AS T3 ON T3.master_customer_id = T2.master_customer_id WHERE T3.cmi_details <> 'Schmidt ,  Kertzmann and Lubowitz'


Question:
What are the register ids of electoral registries that have the cross reference source system code 'Electoral' or 'Tax'?
Additional table information: table: local_govt_mdm

Answer: SELECT T1.electoral_register_id FROM Electoral_Register AS T1 JOIN CMI_Cross_References AS T2 ON T1.cmi_cross_ref_id = T2.cmi_cross_ref_id WHERE T2.source_system_code = 'Electoral' OR T2.source_system_code = 'Tax'


Question:
How many different source system code for the cmi cross references are there?
Additional table information: table: local_govt_mdm

Answer: SELECT COUNT(DISTINCT source_system_code) FROM CMI_cross_references


Question:
List all information about customer master index, and sort them by details in descending order.
Additional table information: table: local_govt_mdm

Answer: SELECT * FROM customer_master_index ORDER BY cmi_details DESC


Question:
List the council tax ids and their related cmi cross references of all the parking fines.
Additional table information: table: local_govt_mdm

Answer: SELECT council_tax_id, cmi_cross_ref_id FROM parking_fines


Question:
How many council taxes are collected for renting arrears ?
Additional table information: table: local_govt_mdm

Answer: SELECT COUNT(*) FROM rent_arrears


Question:
What are the distinct cross reference source system codes which are related to the master customer details 'Gottlieb, Becker and Wyman'?
Additional table information: table: local_govt_mdm

Answer: SELECT DISTINCT T2.source_system_code FROM customer_master_index AS T1 JOIN cmi_cross_references AS T2 ON T1.master_customer_id = T2.master_customer_id WHERE T1.cmi_details = 'Gottlieb ,  Becker and Wyman'


Question:
Which cmi cross reference id is not related to any parking taxes?
Additional table information: table: local_govt_mdm

Answer: SELECT cmi_cross_ref_id FROM cmi_cross_references EXCEPT SELECT cmi_cross_ref_id FROM parking_fines


Question:
Which distinct source system code includes the substring 'en'?
Additional table information: table: local_govt_mdm

Answer: SELECT DISTINCT source_system_code FROM cmi_cross_references WHERE source_system_code LIKE '%en%'


Question:
How many parties are there?
Additional table information: table: party_host

Answer: SELECT COUNT(*) FROM party


Question:
Count the number of parties.
Additional table information: table: party_host

Answer: SELECT COUNT(*) FROM party


Question:
List the themes of parties in ascending order of number of hosts.
Additional table information: table: party_host

Answer: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC NULLS FIRST


Question:
What are the themes of parties ordered by the number of hosts in ascending manner?
Additional table information: table: party_host

Answer: SELECT Party_Theme FROM party ORDER BY Number_of_hosts ASC NULLS FIRST


Question:
What are the themes and locations of parties?
Additional table information: table: party_host

Answer: SELECT Party_Theme, LOCATION FROM party


Question:
Give me the theme and location of each party.
Additional table information: table: party_host

Answer: SELECT Party_Theme, LOCATION FROM party


Question:
Show the first year and last year of parties with theme 'Spring' or 'Teqnology'.
Additional table information: table: party_host

Answer: SELECT First_year, Last_year FROM party WHERE Party_Theme = 'Spring' OR Party_Theme = 'Teqnology'


Question:
What are the first year and last year of the parties whose theme is 'Spring' or 'Teqnology'?
Additional table information: table: party_host

Answer: SELECT First_year, Last_year FROM party WHERE Party_Theme = 'Spring' OR Party_Theme = 'Teqnology'


Question:
What is the average number of hosts for parties?
Additional table information: table: party_host

Answer: SELECT AVG(Number_of_hosts) FROM party


Question:
Compute the average number of hosts for parties.
Additional table information: table: party_host

Answer: SELECT AVG(Number_of_hosts) FROM party


Question:
What is the location of the party with the most hosts?
Additional table information: table: party_host

Answer: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1


Question:
Which party had the most hosts? Give me the party location.
Additional table information: table: party_host

Answer: SELECT LOCATION FROM party ORDER BY Number_of_hosts DESC LIMIT 1


Question:
Show different nationalities along with the number of hosts of each nationality.
Additional table information: table: party_host

Answer: SELECT Nationality, COUNT(*) FROM HOST GROUP BY Nationality


Question:
How many hosts does each nationality have? List the nationality and the count.
Additional table information: table: party_host

Answer: SELECT Nationality, COUNT(*) FROM HOST GROUP BY Nationality


Question:
Show the most common nationality of hosts.
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which nationality has the most hosts?
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the nations that have both hosts older than 45 and hosts younger than 35.
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35


Question:
Which nations have both hosts of age above 45 and hosts of age below 35?
Additional table information: table: party_host

Answer: SELECT Nationality FROM HOST WHERE Age > 45 INTERSECT SELECT Nationality FROM HOST WHERE Age < 35


Question:
Show the themes of parties and the names of the party hosts.
Additional table information: table: party_host

Answer: SELECT T3.Party_Theme, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID


Question:
For each party, return its theme and the name of its host.
Additional table information: table: party_host

Answer: SELECT T3.Party_Theme, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID


Question:
Show the locations of parties and the names of the party hosts in ascending order of the age of the host.
Additional table information: table: party_host

Answer: SELECT T3.Location, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age NULLS FIRST


Question:
For each party, find its location and the name of its host. Sort the result in ascending order of the age of the host.
Additional table information: table: party_host

Answer: SELECT T3.Location, T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID ORDER BY T2.Age NULLS FIRST


Question:
Show the locations of parties with hosts older than 50.
Additional table information: table: party_host

Answer: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50


Question:
Which parties have hosts of age above 50? Give me the party locations.
Additional table information: table: party_host

Answer: SELECT T3.Location FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T2.Age > 50


Question:
Show the host names for parties with number of hosts greater than 20.
Additional table information: table: party_host

Answer: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20


Question:
Which parties have more than 20 hosts? Give me the host names for these parties.
Additional table information: table: party_host

Answer: SELECT T2.Name FROM party_host AS T1 JOIN HOST AS T2 ON T1.Host_ID = T2.Host_ID JOIN party AS T3 ON T1.Party_ID = T3.Party_ID WHERE T3.Number_of_hosts > 20


Question:
Show the name and the nationality of the oldest host.
Additional table information: table: party_host

Answer: SELECT Name, Nationality FROM HOST ORDER BY Age DESC LIMIT 1


Question:
What are the name and the nationality of the host of the highest age?
Additional table information: table: party_host

Answer: SELECT Name, Nationality FROM HOST ORDER BY Age DESC LIMIT 1


Question:
List the names of hosts who did not serve as a host of any party in our record.
Additional table information: table: party_host

Answer: SELECT Name FROM HOST WHERE NOT Host_ID IN (SELECT Host_ID FROM party_host)


Question:
What are the names of hosts who did not host any party in our record?
Additional table information: table: party_host

Answer: SELECT Name FROM HOST WHERE NOT Host_ID IN (SELECT Host_ID FROM party_host)


Question:
How many regions do we have?
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM region


Question:
Count the number of regions.
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM region


Question:
Show all region code and region name sorted by the codes.
Additional table information: table: storm_record

Answer: SELECT region_code, region_name FROM region ORDER BY region_code NULLS FIRST


Question:
What are the codes and names for all regions, sorted by codes?
Additional table information: table: storm_record

Answer: SELECT region_code, region_name FROM region ORDER BY region_code NULLS FIRST


Question:
List all region names in alphabetical order.
Additional table information: table: storm_record

Answer: SELECT region_name FROM region ORDER BY region_name NULLS FIRST


Question:
What are the names of the regions in alphabetical order?
Additional table information: table: storm_record

Answer: SELECT region_name FROM region ORDER BY region_name NULLS FIRST


Question:
Show names for all regions except for Denmark.
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE region_name <> 'Denmark'


Question:
Return the names of all regions other than Denmark.
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE region_name <> 'Denmark'


Question:
How many storms had death records?
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM storm WHERE Number_Deaths > 0


Question:
Count the number of storms in which at least 1 person died.
Additional table information: table: storm_record

Answer: SELECT COUNT(*) FROM storm WHERE Number_Deaths > 0


Question:
List name, dates active, and number of deaths for all storms with at least 1 death.
Additional table information: table: storm_record

Answer: SELECT name, dates_active, number_deaths FROM storm WHERE number_deaths >= 1


Question:
What are the names, dates active, and number of deaths for storms that had 1 or more death?
Additional table information: table: storm_record

Answer: SELECT name, dates_active, number_deaths FROM storm WHERE number_deaths >= 1


Question:
Show the average and maximum damage for all storms with max speed higher than 1000.
Additional table information: table: storm_record

Answer: SELECT AVG(damage_millions_USD), MAX(damage_millions_USD) FROM storm WHERE max_speed > 1000


Question:
What is the average and maximum damage in millions for storms that had a max speed over 1000?
Additional table information: table: storm_record

Answer: SELECT AVG(damage_millions_USD), MAX(damage_millions_USD) FROM storm WHERE max_speed > 1000


Question:
What is the total number of deaths and damage for all storms with a max speed greater than the average?
Additional table information: table: storm_record

Answer: SELECT SUM(number_deaths), SUM(damage_millions_USD) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)


Question:
Return the total number of deaths and total damange in millions for storms that had a max speed greater than the average.
Additional table information: table: storm_record

Answer: SELECT SUM(number_deaths), SUM(damage_millions_USD) FROM storm WHERE max_speed > (SELECT AVG(max_speed) FROM storm)


Question:
List name and damage for all storms in a descending order of max speed.
Additional table information: table: storm_record

Answer: SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC


Question:
What are the names and damage in millions for storms, ordered by their max speeds descending?
Additional table information: table: storm_record

Answer: SELECT name, damage_millions_USD FROM storm ORDER BY max_speed DESC


Question:
How many regions are affected?
Additional table information: table: storm_record

Answer: SELECT COUNT(DISTINCT region_id) FROM affected_region


Question:
Count the number of different affected regions.
Additional table information: table: storm_record

Answer: SELECT COUNT(DISTINCT region_id) FROM affected_region


Question:
Show the name for regions not affected.
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE NOT region_id IN (SELECT region_id FROM affected_region)


Question:
What are the names of regions that were not affected?
Additional table information: table: storm_record

Answer: SELECT region_name FROM region WHERE NOT region_id IN (SELECT region_id FROM affected_region)


Question:
Show the name for regions and the number of storms for each region.
Additional table information: table: storm_record

Answer: SELECT T1.region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id


Question:
How many storms occured in each region?
Additional table information: table: storm_record

Answer: SELECT T1.region_name, COUNT(*) FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id


Question:
List the name for storms and the number of affected regions for each storm.
Additional table information: table: storm_record

Answer: SELECT T1.name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id


Question:
How many regions were affected by each storm?
Additional table information: table: storm_record

Answer: SELECT T1.name, COUNT(*) FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id


Question:
What is the storm name and max speed which affected the greatest number of regions?
Additional table information: table: storm_record

Answer: SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Return the name and max speed of the storm that affected the most regions.
Additional table information: table: storm_record

Answer: SELECT T1.name, T1.max_speed FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the name of storms which don't have affected region in record.
Additional table information: table: storm_record

Answer: SELECT name FROM storm WHERE NOT storm_id IN (SELECT storm_id FROM affected_region)


Question:
What are the names of storms that did not affect any regions?
Additional table information: table: storm_record

Answer: SELECT name FROM storm WHERE NOT storm_id IN (SELECT storm_id FROM affected_region)


Question:
Show storm name with at least two regions and 10 cities affected.
Additional table information: table: storm_record

Answer: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING SUM(T2.number_city_affected) >= 10


Question:
What are the names of storms that both affected two or more regions and affected a total of 10 or more cities?
Additional table information: table: storm_record

Answer: SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2 INTERSECT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING SUM(T2.number_city_affected) >= 10


Question:
Show all storm names except for those with at least two affected regions.
Additional table information: table: storm_record

Answer: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2


Question:
What are the names of storms that did not affect two or more regions?
Additional table information: table: storm_record

Answer: SELECT name FROM storm EXCEPT SELECT T1.name FROM storm AS T1 JOIN affected_region AS T2 ON T1.storm_id = T2.storm_id GROUP BY T1.storm_id HAVING COUNT(*) >= 2


Question:
What are the region names affected by the storm with a number of deaths of least 10?
Additional table information: table: storm_record

Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10


Question:
Return the names of the regions affected by storms that had a death count of at least 10.
Additional table information: table: storm_record

Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T3.number_deaths >= 10


Question:
Show all storm names affecting region 'Denmark'.
Additional table information: table: storm_record

Answer: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'


Question:
What are the names of the storms that affected Denmark?
Additional table information: table: storm_record

Answer: SELECT T3.name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.region_name = 'Denmark'


Question:
Show the region name with at least two storms.
Additional table information: table: storm_record

Answer: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2


Question:
What are the names of regions with two or more storms?
Additional table information: table: storm_record

Answer: SELECT T1.region_name FROM region AS T1 JOIN affected_region AS T2 ON T1.region_id = T2.region_id GROUP BY T1.region_id HAVING COUNT(*) >= 2


Question:
Find the names of the regions which were affected by the storm that killed the greatest number of people.
Additional table information: table: storm_record

Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1


Question:
What are the names of regions that were affected by the storm in which the most people died?
Additional table information: table: storm_record

Answer: SELECT T2.region_name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id ORDER BY T3.Number_Deaths DESC LIMIT 1


Question:
Find the name of the storm that affected both Afghanistan and Albania regions.
Additional table information: table: storm_record

Answer: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'


Question:
What are the names of the storms that affected both the regions of Afghanistan and Albania?
Additional table information: table: storm_record

Answer: SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Afghanistan' INTERSECT SELECT T3.Name FROM affected_region AS T1 JOIN region AS T2 ON T1.region_id = T2.region_id JOIN storm AS T3 ON T1.storm_id = T3.storm_id WHERE T2.Region_name = 'Albania'


Question:
How many counties are there in total?
Additional table information: table: election

Answer: SELECT COUNT(*) FROM county


Question:
Count the total number of counties.
Additional table information: table: election

Answer: SELECT COUNT(*) FROM county


Question:
Show the county name and population of all counties.
Additional table information: table: election

Answer: SELECT County_name, Population FROM county


Question:
What are the name and population of each county?
Additional table information: table: election

Answer: SELECT County_name, Population FROM county


Question:
Show the average population of all counties.
Additional table information: table: election

Answer: SELECT AVG(Population) FROM county


Question:
On average how large is the population of the counties?
Additional table information: table: election

Answer: SELECT AVG(Population) FROM county


Question:
Return the maximum and minimum population among all counties.
Additional table information: table: election

Answer: SELECT MAX(Population), MIN(Population) FROM county


Question:
What are the maximum and minimum population of the counties?
Additional table information: table: election

Answer: SELECT MAX(Population), MIN(Population) FROM county


Question:
Show all the distinct districts for elections.
Additional table information: table: election

Answer: SELECT DISTINCT District FROM election


Question:
What are the distinct districts for elections?
Additional table information: table: election

Answer: SELECT DISTINCT District FROM election


Question:
Show the zip code of the county with name 'Howard'.
Additional table information: table: election

Answer: SELECT Zip_code FROM county WHERE County_name = 'Howard'


Question:
What is the zip code the county named 'Howard' is located in?
Additional table information: table: election

Answer: SELECT Zip_code FROM county WHERE County_name = 'Howard'


Question:
Show the delegate from district 1 in election.
Additional table information: table: election

Answer: SELECT Delegate FROM election WHERE District = 1


Question:
Who is the delegate of district 1 in the elections?
Additional table information: table: election

Answer: SELECT Delegate FROM election WHERE District = 1


Question:
Show the delegate and committee information of elections.
Additional table information: table: election

Answer: SELECT Delegate, Committee FROM election


Question:
What are the delegate and committee information for each election record?
Additional table information: table: election

Answer: SELECT Delegate, Committee FROM election


Question:
How many distinct governors are there?
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT Governor) FROM party


Question:
Count the number of distinct governors.
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT Governor) FROM party


Question:
Show the lieutenant governor and comptroller from the democratic party.
Additional table information: table: election

Answer: SELECT Lieutenant_Governor, Comptroller FROM party WHERE Party = 'Democratic'


Question:
Who are the lieutenant governor and comptroller from the democratic party?
Additional table information: table: election

Answer: SELECT Lieutenant_Governor, Comptroller FROM party WHERE Party = 'Democratic'


Question:
In which distinct years was the governor 'Eliot Spitzer'?
Additional table information: table: election

Answer: SELECT DISTINCT YEAR FROM party WHERE Governor = 'Eliot Spitzer'


Question:
Find the distinct years when the governor was named 'Eliot Spitzer'.
Additional table information: table: election

Answer: SELECT DISTINCT YEAR FROM party WHERE Governor = 'Eliot Spitzer'


Question:
Show all the information about election.
Additional table information: table: election

Answer: SELECT * FROM election


Question:
Return all the information for each election record.
Additional table information: table: election

Answer: SELECT * FROM election


Question:
Show the delegates and the names of county they belong to.
Additional table information: table: election

Answer: SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District


Question:
What are the delegate and name of the county they belong to, for each county?
Additional table information: table: election

Answer: SELECT T2.Delegate, T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District


Question:
Which delegates are from counties with population smaller than 100000?
Additional table information: table: election

Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000


Question:
Find the delegates who are from counties with population below 100000.
Additional table information: table: election

Answer: SELECT T2.Delegate FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population < 100000


Question:
How many distinct delegates are from counties with population larger than 50000?
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000


Question:
Count the number of distinct delegates who are from counties with population above 50000.
Additional table information: table: election

Answer: SELECT COUNT(DISTINCT T2.Delegate) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T1.Population > 50000


Question:
What are the names of the county that the delegates on 'Appropriations' committee belong to?
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = 'Appropriations'


Question:
Which county do the delegates on 'Appropriations' committee belong to? Give me the county names.
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District WHERE T2.Committee = 'Appropriations'


Question:
Show the delegates and the names of the party they belong to.
Additional table information: table: election

Answer: SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID


Question:
For each delegate, find the names of the party they are part of.
Additional table information: table: election

Answer: SELECT T1.Delegate, T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID


Question:
Who were the governors of the parties associated with delegates from district 1?
Additional table information: table: election

Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1


Question:
Find the parties associated with the delegates from district 1. Who served as governors of the parties?
Additional table information: table: election

Answer: SELECT T2.Governor FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1


Question:
Who were the comptrollers of the parties associated with the delegates from district 1 or district 2?
Additional table information: table: election

Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2


Question:
Find the parties associated with the delegates from district 1 or 2. Who served as comptrollers of the parties?
Additional table information: table: election

Answer: SELECT T2.Comptroller FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.District = 1 OR T1.District = 2


Question:
Return all the committees that have delegates from Democratic party.
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic'


Question:
Which committees have delegates from the Democratic party?
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic'


Question:
Show the name of each county along with the corresponding number of delegates from that county.
Additional table information: table: election

Answer: SELECT T1.County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id


Question:
For each county, find the name of the county and the number of delegates from that county.
Additional table information: table: election

Answer: SELECT T1.County_name, COUNT(*) FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id


Question:
Show the name of each party and the corresponding number of delegates from that party.
Additional table information: table: election

Answer: SELECT T2.Party, COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party


Question:
For each party, return the name of the party and the number of delegates from that party.
Additional table information: table: election

Answer: SELECT T2.Party, COUNT(*) FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party


Question:
Return the names of all counties sorted by population in ascending order.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population ASC NULLS FIRST


Question:
Sort the names of all counties in ascending order of population.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population ASC NULLS FIRST


Question:
Return the names of all counties sorted by county name in descending alphabetical order.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY County_name DESC


Question:
Sort the names of all counties in descending alphabetical order.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY County_name DESC


Question:
Show the name of the county with the biggest population.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1


Question:
Which county has the largest population? Give me the name of the county.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population DESC LIMIT 1


Question:
Show the 3 counties with the smallest population.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population ASC NULLS FIRST LIMIT 3


Question:
What are the 3 counties that have the smallest population? Give me the county names.
Additional table information: table: election

Answer: SELECT County_name FROM county ORDER BY Population ASC NULLS FIRST LIMIT 3


Question:
Show the names of counties that have at least two delegates.
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2


Question:
Which counties have two or more delegates? Give me the county names.
Additional table information: table: election

Answer: SELECT T1.County_name FROM county AS T1 JOIN election AS T2 ON T1.County_id = T2.District GROUP BY T1.County_id HAVING COUNT(*) >= 2


Question:
Show the name of the party that has at least two records.
Additional table information: table: election

Answer: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2


Question:
Which party has two or more records?
Additional table information: table: election

Answer: SELECT Party FROM party GROUP BY Party HAVING COUNT(*) >= 2


Question:
Show the name of the party that has the most delegates.
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which party has the largest number of delegates?
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID GROUP BY T1.Party ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the people that have been governor the most times.
Additional table information: table: election

Answer: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which people severed as governor most frequently?
Additional table information: table: election

Answer: SELECT Governor FROM party GROUP BY Governor ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the people that have been comptroller the most times and the corresponding number of times.
Additional table information: table: election

Answer: SELECT Comptroller, COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1


Question:
Which people severed as comptroller most frequently? Give me the name of the person and the frequency count.
Additional table information: table: election

Answer: SELECT Comptroller, COUNT(*) FROM party GROUP BY Comptroller ORDER BY COUNT(*) DESC LIMIT 1


Question:
What are the names of parties that do not have delegates in election?
Additional table information: table: election

Answer: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)


Question:
Which parties did not have any delegates in elections?
Additional table information: table: election

Answer: SELECT Party FROM party WHERE NOT Party_ID IN (SELECT Party FROM election)


Question:
What are the names of parties that have both delegates on 'Appropriations' committee and
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Appropriations' INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Economic Matters'


Question:
Which parties have delegates in both the 'Appropriations' committee and the 'Economic Matters' committee?
Additional table information: table: election

Answer: SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Appropriations' INTERSECT SELECT T2.Party FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T1.Committee = 'Economic Matters'


Question:
Which committees have delegates from both democratic party and liberal party?
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic' INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Liberal'


Question:
Find the committees that have delegates both from from the democratic party and the liberal party.
Additional table information: table: election

Answer: SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Democratic' INTERSECT SELECT T1.Committee FROM election AS T1 JOIN party AS T2 ON T1.Party = T2.Party_ID WHERE T2.Party = 'Liberal'


Question:
How many journalists are there?
Additional table information: table: news_report

Answer: SELECT COUNT(*) FROM journalist


Question:
List the names of journalists in ascending order of years working.
Additional table information: table: news_report

Answer: SELECT Name FROM journalist ORDER BY Years_working ASC NULLS FIRST


Question:
What are the nationalities and ages of journalists?
Additional table information: table: news_report

Answer: SELECT Nationality, Age FROM journalist


Question:
Show the names of journalists from 'England' or 'Wales'.
Additional table information: table: news_report

Answer: SELECT Name FROM journalist WHERE Nationality = 'England' OR Nationality = 'Wales'


Question:
What is the average number of years spent working as a journalist?
Additional table information: table: news_report

Answer: SELECT AVG(Years_working) FROM journalist


Question:
What is the nationality of the journalist with the largest number of years working?
Additional table information: table: news_report

Answer: SELECT Nationality FROM journalist ORDER BY Years_working DESC LIMIT 1


Question:
Show the different nationalities and the number of journalists of each nationality.
Additional table information: table: news_report

Answer: SELECT Nationality, COUNT(*) FROM journalist GROUP BY Nationality


Question:
Show the most common nationality for journalists.
Additional table information: table: news_report

Answer: SELECT Nationality FROM journalist GROUP BY Nationality ORDER BY COUNT(*) DESC LIMIT 1


Question:
Show the nations that have both journalists with more than 10 years of working and journalists with less than 3 years of working.
Additional table information: table: news_report

Answer: SELECT Nationality FROM journalist WHERE Years_working > 10 INTERSECT SELECT Nationality FROM journalist WHERE Years_working < 3


Question:
Show the dates, places, and names of events in descending order of the attendance.
Additional table information: table: news_report

Answer: SELECT Date, Name, venue FROM event ORDER BY Event_Attendance DESC


Question:
Show the names of journalists and the dates of the events they reported.
Additional table information: table: news_report

Answer: SELECT T3.Name, T2.Date FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID


Question:
Show the names of journalists and the names of the events they reported in ascending order
Additional table information: table: news_report

Answer: SELECT T3.Name, T2.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID ORDER BY T2.Event_Attendance ASC NULLS FIRST


Question:
Show the names of journalists and the number of events they reported.
Additional table information: table: news_report

Answer: SELECT T3.Name, COUNT(*) FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name


Question:
Show the names of journalists that have reported more than one event.
Additional table information: table: news_report

Answer: SELECT T3.Name FROM news_report AS T1 JOIN event AS T2 ON T1.Event_ID = T2.Event_ID JOIN journalist AS T3 ON T1.journalist_ID = T3.journalist_ID GROUP BY T3.Name HAVING COUNT(*) > 1


Question:
List the names of journalists who have not reported any event.
Additional table information: table: news_report

Answer: SELECT Name FROM journalist WHERE NOT journalist_ID IN (SELECT journalist_ID FROM news_report)


Question:
what are the average and maximum attendances of all events?
Additional table information: table: news_report

Answer: SELECT AVG(Event_Attendance), MAX(Event_Attendance) FROM event


Question:
Find the average age and experience working length of journalists working on different role type.
Additional table information: table: news_report

Answer: SELECT AVG(t1.age), AVG(Years_working), t2.work_type FROM journalist AS t1 JOIN news_report AS t2 ON t1.journalist_id = t2.journalist_id GROUP BY t2.work_type


Question:
List the event venues and names that have the top 2 most number of people attended.
Additional table information: table: news_report

Answer: SELECT venue, name FROM event ORDER BY Event_Attendance DESC LIMIT 2


Question:
Show me all the restaurants.
Additional table information: table: restaurant_1

Answer: SELECT ResName FROM Restaurant


Question:
What is the address of the restaurant Subway?
Additional table information: table: restaurant_1

Answer: SELECT Address FROM Restaurant WHERE ResName = 'Subway'


Question:
What is the rating of the restaurant Subway?
Additional table information: table: restaurant_1

Answer: SELECT Rating FROM Restaurant WHERE ResName = 'Subway'


Question:
List all restaurant types.
Additional table information: table: restaurant_1

Answer: SELECT ResTypeName FROM Restaurant_Type


Question:
What is the description of the restaurant type Sandwich?
Additional table information: table: restaurant_1

Answer: SELECT ResTypeDescription FROM Restaurant_Type WHERE ResTypeName = 'Sandwich'


Question:
Which restaurants have highest rating? List the restaurant name and its rating.
Additional table information: table: restaurant_1

Answer: SELECT ResName, Rating FROM Restaurant ORDER BY Rating DESC LIMIT 1


Question:
What is the age of student Linda Smith?
Additional table information: table: restaurant_1

Answer: SELECT Age FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith'


Question:
What is the gender of the student Linda Smith?
Additional table information: table: restaurant_1

Answer: SELECT Sex FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith'


Question:
List all students' first names and last names who majored in 600.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Major = 600


Question:
Which city does student Linda Smith live in?
Additional table information: table: restaurant_1

Answer: SELECT city_code FROM Student WHERE Fname = 'Linda' AND Lname = 'Smith'


Question:
Advisor 1121 has how many students?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Student WHERE Advisor = 1121


Question:
Which Advisor has most of students? List advisor and the number of students.
Additional table information: table: restaurant_1

Answer: SELECT Advisor, COUNT(*) FROM Student GROUP BY Advisor ORDER BY COUNT(Advisor) DESC LIMIT 1


Question:
Which major has least number of students? List the major and the number of students.
Additional table information: table: restaurant_1

Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major ORDER BY COUNT(Major) ASC NULLS FIRST LIMIT 1


Question:
Which major has between 2 and 30 number of students? List major and the number of students.
Additional table information: table: restaurant_1

Answer: SELECT Major, COUNT(*) FROM Student GROUP BY Major HAVING COUNT(Major) BETWEEN 2 AND 30


Question:
Which student's age is older than 18 and is majoring in 600? List each student's first and last name.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major = 600


Question:
List all female students age is older than 18 who is not majoring in 600. List students' first name and last name.
Additional table information: table: restaurant_1

Answer: SELECT Fname, Lname FROM Student WHERE Age > 18 AND Major <> 600 AND Sex = 'F'


Question:
How many restaurant is the Sandwich type restaurant?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Restaurant JOIN Type_Of_Restaurant ON Restaurant.ResID = Type_Of_Restaurant.ResID JOIN Restaurant_Type ON Type_Of_Restaurant.ResTypeID = Restaurant_Type.ResTypeID GROUP BY Type_Of_Restaurant.ResTypeID HAVING Restaurant_Type.ResTypeName = 'Sandwich'


Question:
How long does student Linda Smith spend on the restaurant in total?
Additional table information: table: restaurant_1

Answer: SELECT SUM(Spent) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith'


Question:
How many times has the student Linda Smith visited Subway?
Additional table information: table: restaurant_1

Answer: SELECT COUNT(*) FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith' AND Restaurant.ResName = 'Subway'


Question:
When did Linda Smith visit Subway?
Additional table information: table: restaurant_1

Answer: SELECT TIME FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID WHERE Student.Fname = 'Linda' AND Student.Lname = 'Smith' AND Restaurant.ResName = 'Subway'


Question:
At which restaurant did the students spend the least amount of time? List restaurant and the time students spent on in total.
Additional table information: table: restaurant_1

Answer: SELECT Restaurant.ResName, SUM(Visits_Restaurant.Spent) FROM Visits_Restaurant JOIN Restaurant ON Visits_Restaurant.ResID = Restaurant.ResID GROUP BY Restaurant.ResID ORDER BY SUM(Visits_Restaurant.Spent) ASC NULLS FIRST LIMIT 1


Question:
Which student visited restaurant most often? List student's first name and last name.
Additional table information: table: restaurant_1

Answer: SELECT Student.Fname, Student.Lname FROM Student JOIN Visits_Restaurant ON Student.StuID = Visits_Restaurant.StuID GROUP BY Student.StuID ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the ids of orders whose status is 'Success'.
Additional table information: table: customer_deliveries

Answer: SELECT actual_order_id FROM actual_orders WHERE order_status_code = 'Success'


Question:
Find the name and price of the product that has been ordered the greatest number of times.
Additional table information: table: customer_deliveries

Answer: SELECT t1.product_name, t1.product_price FROM products AS t1 JOIN regular_order_products AS t2 ON t1.product_id = t2.product_id GROUP BY t2.product_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
Find the number of customers in total.
Additional table information: table: customer_deliveries

Answer: SELECT COUNT(*) FROM customers


Question:
How many different payment methods are there?
Additional table information: table: customer_deliveries

Answer: SELECT COUNT(DISTINCT payment_method) FROM customers


Question:
Show the details of all trucks in the order of their license number.
Additional table information: table: customer_deliveries

Answer: SELECT truck_details FROM trucks ORDER BY truck_licence_number NULLS FIRST


Question:
Find the name of the most expensive product.
Additional table information: table: customer_deliveries

Answer: SELECT product_name FROM products ORDER BY product_price DESC LIMIT 1


Question:
Find the names of customers who are not living in the state of California.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name FROM customers EXCEPT SELECT t1.customer_name FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'


Question:
List the names and emails of customers who payed by Visa card.
Additional table information: table: customer_deliveries

Answer: SELECT customer_email, customer_name FROM customers WHERE payment_method = 'Visa'


Question:
Find the names and phone numbers of customers living in California state.
Additional table information: table: customer_deliveries

Answer: SELECT t1.customer_name, t1.customer_phone FROM customers AS t1 JOIN customer_addresses AS t2 ON t1.customer_id = t2.customer_id JOIN addresses AS t3 ON t2.address_id = t3.address_id WHERE t3.state_province_county = 'California'


Question:
Find the states which do not have any employee in their record.
Additional table information: table: customer_deliveries

Answer: SELECT state_province_county FROM addresses WHERE NOT address_id IN (SELECT employee_address_id FROM Employees)


Question:
List the names, phone numbers, and emails of all customers sorted by their dates of becoming customers.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name, customer_phone, customer_email FROM Customers ORDER BY date_became_customer NULLS FIRST


Question:
Find the name of the first 5 customers.
Additional table information: table: customer_deliveries

Answer: SELECT customer_name FROM Customers ORDER BY date_became_customer NULLS FIRST LIMIT 5


Question:
Find the payment method that is used most frequently.
Additional table information: table: customer_deliveries

Answer: SELECT payment_method FROM Customers GROUP BY payment_method ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the names of all routes in alphabetic order.
Additional table information: table: customer_deliveries

Answer: SELECT route_name FROM Delivery_Routes ORDER BY route_name NULLS FIRST


Question:
Find the name of route that has the highest number of deliveries.
Additional table information: table: customer_deliveries

Answer: SELECT t1.route_name FROM Delivery_Routes AS t1 JOIN Delivery_Route_Locations AS t2 ON t1.route_id = t2.route_id GROUP BY t1.route_id ORDER BY COUNT(*) DESC LIMIT 1


Question:
List the state names and the number of customers living in each state.
Additional table information: table: customer_deliveries

Answer: SELECT t2.state_province_county, COUNT(*) FROM customer_addresses AS t1 JOIN addresses AS t2 ON t1.address_id = t2.address_id GROUP BY t2.state_province_county


Question:
How many authors are there?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM authors


Question:
Count the number of authors.
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM authors


Question:
How many institutions are there?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM inst


Question:
Count the number of institutions.
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM inst


Question:
How many papers are published in total?
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM papers


Question:
Count the number of total papers.
Additional table information: table: icfp_1

Answer: SELECT COUNT(*) FROM papers


Question:
What are the titles of papers published by 'Jeremy Gibbons'?
Additional table information: table: icfp_1

Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = 'Jeremy' AND t1.lname = 'Gibbons'


Question:
Find the titles of all the papers written by 'Jeremy Gibbons'
Additional table information: table: icfp_1

Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = 'Jeremy' AND t1.lname = 'Gibbons'


Question:
Find all the papers published by 'Aaron Turon'.
Additional table information: table: icfp_1

Answer: SELECT t3.title FROM authors AS t1 JOIN authorship AS t2 ON t1.authid = t2.authid JOIN papers AS t3 ON t2.paperid = t3.paperid WHERE t1.fname = 'Aaron' AND t1.lname = 'Turon'