aherntech/sparc huggingface dataset:
Database: voter_2
Question sequence:
How many students have Vice President votes?
Count the number of those students whose city code is not PIT.
Please list their names.
Please only list their first names.
SQL query sequence:
SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  VICE_PRESIDENT_Vote
SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  VICE_PRESIDENT_Vote WHERE city_code != "PIT"
SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname, Lname FROM STUDENT WHERE city_code  =  "PIT"
SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code  =  "PIT"
Final question: Find the distinct first names of all the students who have vice president votes and whose city code is not PIT.
Final SQL: SELECT DISTINCT T1.Fname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.VICE_PRESIDENT_Vote EXCEPT SELECT DISTINCT Fname FROM STUDENT WHERE city_code  =  "PIT"
Database: voter_2
Question sequence:
Which students have president votes?
How many of those students do not have advisor 2192?
What are their names?
Please only list last names.
SQL query sequence:
SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.PRESIDENT_Vote
SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.PRESIDENT_Vote WHERE T1.Advisor != "2192"
SELECT DISTINCT T1.FName, T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote EXCEPT SELECT DISTINCT FName, LName FROM STUDENT WHERE Advisor  =  "2192"
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "2192"
Final question: Find the distinct last names of all the students who have president votes and whose advisor is not 2192.
Final SQL: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote EXCEPT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "2192"
Database: voter_2
Question sequence:
How many students have president votes?
How many of those students have advisor 8741?
What are their names?
Please only list last names.
SQL query sequence:
SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.PRESIDENT_Vote
SELECT count(DISTINCT T1.StuID) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.PRESIDENT_Vote WHERE T1.Advisor = "8741"
SELECT DISTINCT T1.Fname, T1.Lname FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  T2.PRESIDENT_Vote WHERE T1.Advisor = "8741"
SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "8741"
Final question: Find the distinct last names of all the students who have president votes and whose advisor is 8741.
Final SQL: SELECT DISTINCT T1.LName FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID  =  PRESIDENT_Vote INTERSECT SELECT DISTINCT LName FROM STUDENT WHERE Advisor  =  "8741"
Database: voter_2
Question sequence:
What are all of the advisors?
How many advise 2 students or less?
How many advise more than 2 students?
Please report these advisors.
SQL query sequence:
SELECT DISTINCT Advisor FROM STUDENT
SELECT count(*) FROM (SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  <=  2)
SELECT count(*) FROM (SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  >  2)
SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  >  2
Final question: Report all advisors that advise more than 2 students.
Final SQL: SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT(*)  >  2
Database: voter_2
Question sequence:
Report all majors.
How many have 3 students or more?
How many have less than 3 students?
Report those majors with less than 3 students.
SQL query sequence:
SELECT DISTINCT Major FROM STUDENT
SELECT count(*) FROM (SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  >=  3)
SELECT count(*) FROM (SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  <  3)
SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  <  3
Final question: Report all majors that have less than 3 students.
Final SQL: SELECT Major FROM STUDENT GROUP BY Major HAVING COUNT(*)  <  3
Database: voter_2
Question sequence:
Report all majors.
Report the number of students per major as well.
Order the majors by decreasing number of students.
Which major has the most students?
SQL query sequence:
SELECT DISTINCT Major FROM STUDENT
SELECT Major, count(*) FROM STUDENT GROUP BY Major
SELECT Major, count(*) FROM STUDENT GROUP BY Major ORDER BY count(*) DESC
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
Final question: Which major has the most students?
Final SQL: SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
Database: voter_2
Question sequence:
List the majors of female students.
Order the majors by decreasing number of students.
What is the most common major?
SQL query sequence:
SELECT DISTINCT Major FROM STUDENT WHERE Sex = "F"
SELECT DISTINCT Major FROM STUDENT WHERE Sex = "F" GROUP BY major ORDER BY count(*) DESC
SELECT Major FROM STUDENT WHERE Sex  =  "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
Final question: What is the most common major among female (sex is F) students?
Final SQL: SELECT Major FROM STUDENT WHERE Sex  =  "F" GROUP BY major ORDER BY count(*) DESC LIMIT 1
Database: voter_2
Question sequence:
How many students live in each city?
List the cities from the one with the most students to the one with the least students.
How many students live in the most popular city?
What is the city code of the most popular city?
SQL query sequence:
SELECT city_code, count(*) FROM STUDENT GROUP BY city_code
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC
SELECT count(*) FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
Final question: What is the city_code of the city that the most students live in?
Final SQL: SELECT city_code FROM STUDENT GROUP BY city_code ORDER BY count(*) DESC LIMIT 1
Database: movie_1
Question sequence:
Give me movies that are directed by James Cameron.
What about those that also produced after 2000 at the same time?
SQL query sequence:
SELECT title FROM MOVIE WHERE director = 'James Cameron'
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR  >  2000
Final question: What is the name of the movie produced after 2000 and directed by James Cameron?
Final SQL: SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR  >  2000
Database: movie_1
Question sequence:
Give me the name of all reviewers.
Whose name contains "Mike"?
What about his id?
SQL query sequence:
SELECT name FROM Reviewer
SELECT name FROM Reviewer WHERE name LIKE "%Mike%"
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
Final question: What is the id of the reviewer whose name has substring “Mike”?
Final SQL: SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
Database: movie_1
Question sequence:
What are the ratings?
Show me the lowest and highest stars.
SQL query sequence:
SELECT * FROM Rating
SELECT max(stars) ,  min(stars) FROM Rating
Final question: What is the lowest and highest rating star?
Final SQL: SELECT max(stars) ,  min(stars) FROM Rating
Database: movie_1
Question sequence:
Show me the name of all movies.
What about their ratings?
Only show those with a rating of 4 or 5.
Give me all years that have any of those movies in the order of year.
SQL query sequence:
SELECT title FROM movie
SELECT t1.title, t2.stars FROM Movie AS t1 JOIN Rating AS t2 on t1.mID = t2.mID
SELECT t1.title, t2.stars FROM Movie AS t1 JOIN Rating AS t2 on t1.mID = t2.mID WHERE t2.stars >= 4
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  >=  4 ORDER BY T1.year
Final question: Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
Final SQL: SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  >=  4 ORDER BY T1.year
Database: movie_1
Question sequence:
Show me the names of all movies.
What about those with 5 star rating?
Who directed those movies?
SQL query sequence:
SELECT title FROM movie
SELECT t1.title FROM movie AS t1 JOIN Rating AS t2 ON t1.mID = t2.mID where t2.stars = 5
SELECT T1.director ,  T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  =  5
Final question: What are the names of directors who directed movies with 5 star rating? Also return the title of these movies.
Final SQL: SELECT T1.director ,  T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID WHERE T2.stars  =  5
Database: movie_1
Question sequence:
Who are all the reviewers?
What is their highest rating?
What is their lowest rating?
What about their average rating?
SQL query sequence:
SELECT name FROM Reviewer
SELECT T2.name ,  max(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name
SELECT T2.name ,  min(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name
SELECT T2.name ,  avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name
Final question: What is the average rating star for each reviewer?
Final SQL: SELECT T2.name ,  avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T2.name
Database: movie_1
Question sequence:
What are the title of all movies?
What about those without any rating?
SQL query sequence:
SELECT title FROM movie
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
Final question: Find the titles of all movies that have no ratings.
Final SQL: SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
Database: movie_1
Question sequence:
What are the titles of all movies?
Which one is the oldest?
What is its average rating stars?
SQL query sequence:
SELECT title FROM movie
SELECT title FROM movie WHERE Year = (SELECT min(YEAR) FROM Movie)
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)
Final question: What is the average rating stars and title for the oldest movie?
Final SQL: 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)
Database: movie_1
Question sequence:
What are the titles of all movies?
Which one is the most recent?
SQL query sequence:
SELECT title FROM movie
SELECT title FROM movie WHERE Year = (SELECT max(YEAR) FROM Movie)
Final question: What is the name of the most recent movie?
Final SQL: SELECT title FROM Movie WHERE YEAR  =  (SELECT max(YEAR) FROM Movie)
Database: movie_1
Question sequence:
What are the titles of all movies?
Which one is the most recent?
What is its highest rating stars?
SQL query sequence:
SELECT title FROM movie
SELECT title FROM movie WHERE Year = (SELECT max(YEAR) FROM Movie)
SELECT max(T1.stars) ,  T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T2.year  =  (SELECT max(YEAR) FROM Movie)
Final question: What is the maximum stars and year for the most recent movie?
Final SQL: 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)
Database: movie_1
Question sequence:
Show me the movies directed by Steven Spielberg.
What about their years?
Show me the movies that were created after all of the above movies.
SQL query sequence:
SELECT title FROM Movie WHERE director  =  "Steven Spielberg"
SELECT title, year FROM Movie WHERE director  =  "Steven Spielberg"
SELECT title FROM Movie WHERE YEAR  >  (SELECT max(YEAR) FROM Movie WHERE director  =  "Steven Spielberg")
Final question: What are the names of movies whose created year is after all movies directed by Steven Spielberg?
Final SQL: SELECT title FROM Movie WHERE YEAR  >  (SELECT max(YEAR) FROM Movie WHERE director  =  "Steven Spielberg")
Database: movie_1
Question sequence:
Show me the movies directed by James Cameron.
What about their rating stars?
Show me the average of them.
Give me the titles and directors of movies whose star is greater than that.
SQL query sequence:
SELECT title FROM Movie WHERE director  =  "James Cameron"
SELECT T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T2.director  =  "James Cameron"
SELECT avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T2.director  =  "James Cameron"
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")
Final 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?
Final SQL: 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")
Database: movie_1
Question sequence:
What are the titles of all movies?
Show me their reviewer's name, stars, and rating date.
Sort them first by reviewer name, then by movie title, and lastly by number of stars.
SQL query sequence:
SELECT title FROM movie
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
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 ,  T2.title ,  T1.stars
Final question: Return reviewer name, movie title, stars, and rating date. And sort the data first by reviewer name, then by movie title, and lastly by number of stars.
Final SQL: 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 ,  T2.title ,  T1.stars
Database: movie_1
Question sequence:
Show me the names of all the reviewers.
What about the ratings they have contributed?
Show me the reviewers who have contributed three or more ratings.
SQL query sequence:
SELECT name FROM Reviewer
SELECT * FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T1.rID HAVING COUNT(*)  >=  3
Final question: Find the names of all reviewers who have contributed three or more ratings.
Final SQL: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID GROUP BY T1.rID HAVING COUNT(*)  >=  3
Database: movie_1
Question sequence:
Show me the ratings for Gone with the Wind.
Give me the names of reviewers who gave those ratings.
SQL query sequence:
SELECT * 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'
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'
Final question: Find the names of all reviewers who rated Gone with the Wind.
Final SQL: 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'
Database: movie_1
Question sequence:
Show me all the ratings given by Sarah Martinez.
What movies are those ratings about?
Show me the directors of those movies.
SQL query sequence:
SELECT * FROM rating AS t1 JOIN Reviewer AS t2 on t1.rID = t2.rID where t2.name = "Sarah Martinez"
SELECT distinct t1.title FROM Movie as t1 JOIN Rating as t2 on t1.mID = t2.mID JOIN Reviewer AS t3 on t2.rID = t3.rID WHERE t3.name = "Sarah Martinez"
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'
Final question: Find the names of all directors whose movies are rated by Sarah Martinez.
Final SQL: 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'
Database: movie_1
Question sequence:
Show me the titles of all the movies.
What about the name of their reviewers and directors?
Show those who have the same names.
Give me the reviewer name, movie title, and number of stars.
SQL query sequence:
SELECT title FROM Movie
SELECT T3.name, T2.title, T2.director FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID JOIN Reviewer AS T3 ON T1.rID  =  T3.rID
SELECT T3.name, T2.title, 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 T2.director  =  T3.name
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
Final 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.
Final SQL: 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
Database: movie_1
Question sequence:
Give me the names of all reviewers.
Show me the title of all movies together in a single list.
SQL query sequence:
SELECT name FROM Reviewer
SELECT name FROM Reviewer UNION SELECT title FROM Movie
Final question: Return all reviewer names and movie names together in a single list.
Final SQL: SELECT name FROM Reviewer UNION SELECT title FROM Movie
Database: movie_1
Question sequence:
Give me the ratings given by Chris Jackson.
What movies are they about?
Show me the movies other than those.
SQL query sequence:
SELECT * FROM rating as t1 JOIN reviewer as t2 on t1.rID = t2.rID and t2.name = 'Chris Jackson'
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'
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'
Final question: Find the titles of all movies not reviewed by Chris Jackson.
Final SQL: 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'
Database: movie_1
Question sequence:
What are all the directors?
How many movies did each of them direct?
Show me those who directed more than one movie.
Show me their directed movies' titles, in the order of director name, then movie title.
SQL query sequence:
SELECT DISTINCT director FROM Movie
SELECT count(*), director FROM Movie group by director
SELECT director FROM Movie group by director having count(*) > 1
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 ,  T1.title
Final 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.
Final SQL: 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 ,  T1.title
Database: movie_1
Question sequence:
What are all the directors?
How many movies did each of them direct?
Show me those who directed more than one movie.
Give me the titles and produced years of all movies directed by them.
SQL query sequence:
SELECT DISTINCT director FROM Movie
SELECT count(*), director FROM Movie group by director
SELECT director FROM Movie group by director having count(*) > 1
SELECT T1.title ,  T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director  =  T2.director WHERE T1.title != T2.title
Final question: For directors who had more than one movie, return the titles and produced years of all movies directed by them.
Final SQL: SELECT T1.title ,  T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director  =  T2.director WHERE T1.title != T2.title
Database: movie_1
Question sequence:
What are all the directors?
How many movies did each of them direct?
Show me those who directed exactly one movie.
SQL query sequence:
SELECT DISTINCT director FROM Movie
SELECT count(*), director FROM Movie group by director
SELECT director FROM Movie group by director having count(*) = 1
Final question: What are the names of the directors who made exactly one movie?
Final SQL: SELECT director FROM Movie GROUP BY director HAVING count(*)  =  1
Database: movie_1
Question sequence:
What are all the directors?
How many movies did each of them direct?
Show me those who directed exactly one movie other than NULL.
SQL query sequence:
SELECT DISTINCT director FROM Movie
SELECT count(*), director FROM Movie group by director
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*)  =  1
Final question: What are the names of the directors who made exactly one movie excluding director NULL?
Final SQL: SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*)  =  1
Database: movie_1
Question sequence:
What are all the directors?
How many movie reviews does each of them get?
SQL query sequence:
SELECT DISTINCT director FROM Movie
SELECT count(*) ,  T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID GROUP BY T1.director
Final question: How many movie reviews does each director get?
Final SQL: SELECT count(*) ,  T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID  =  T2.mID GROUP BY T1.director
Database: movie_1
Question sequence:
What are all the movies?
What are their average ratings?
Give me the movies with the highest average rating.
SQL query sequence:
SELECT title FROM Movie
SELECT T2.title ,  avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID GROUP BY T1.mID
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
Final question: Find the movies with the highest average rating. Return the movie titles and average rating.
Final SQL: 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
Database: movie_1
Question sequence:
What are all the movies?
What are their average ratings?
Give me the movies with the lowest average rating.
SQL query sequence:
SELECT title FROM Movie
SELECT T2.title ,  avg(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID GROUP BY T1.mID
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) LIMIT 1
Final question: What are the movie titles and average rating of the movies with the lowest average rating?
Final SQL: 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) LIMIT 1
Database: movie_1
Question sequence:
Show me the titles all the movies.
What are their ratings?
Show me the names and years of the movies that has the top 3 rating star.
SQL query sequence:
SELECT title FROM Movie
SELECT T2.title ,  T1.stars FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID
SELECT T2.title ,  T2.year FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID ORDER BY T1.stars DESC LIMIT 3
Final question: What are the names and years of the movies that has the top 3 highest rating star?
Final SQL: 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