input
stringlengths
191
7.13k
output
stringlengths
19
578
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT Candidate_ID FROM candidate ORDER BY oppose_rate LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Pl...
SELECT Support_rate , Consider_rate , Oppose_rate FROM candidate ORDER BY unsure_rate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT Support_rate , Consider_rate , Oppose_rate FROM candidate ORDER BY unsure_rate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: wh...
SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Re...
SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Li...
SELECT name FROM people ORDER BY date_of_birth;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT name FROM people ORDER BY date_of_birth;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M';
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M';
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: fi...
SELECT name FROM people WHERE height > 200 OR height < 190;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT name FROM people WHERE height > 200 OR height < 190;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT t1.name , t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT t1.name , t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id ORDER BY t2.support_rate DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT t1.name , t1.sex , min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fo...
SELECT t1.name , t1.sex , min(oppose_rate) FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: wh...
SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY avg(t2.unsure_rate) DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT t1.sex FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id GROUP BY t1.sex ORDER BY avg(t2.unsure_rate) DESC LIMIT 1;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: wh...
SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate);
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Gi...
SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate);
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Fi...
SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t2.support_rate < t2.oppose_rate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: ho...
SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Co...
SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: fi...
SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Re...
SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: li...
SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT t1.name FROM people AS t1 JOIN candidate AS t2 ON t1.people_id = t2.people_id WHERE t1.sex = 'F' ORDER BY t1.name;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: fi...
SELECT name FROM people WHERE height < (SELECT avg(height) FROM people);
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT name FROM people WHERE height < (SELECT avg(height) FROM people);
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Li...
SELECT * FROM people;
Tables: candidate, people Columns: candidate.Candidate_ID, candidate.People_ID, candidate.Poll_Source, candidate.Date, candidate.Support_rate, candidate.Consider_rate, candidate.Oppose_rate, candidate.Unsure_rate, people.People_ID, people.Sex, people.Name, people.Date_of_Birth, people.Height, people.Weight Question: Wh...
SELECT * FROM people;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the titles of all movies directed by steven spielberg. [/INST]
SELECT title FROM Movie WHERE director = 'Steven Spielberg';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all movies directed by Steven Spielberg? [/INST]
SELECT title FROM Movie WHERE director = 'Steven Spielberg';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the name of the movie produced after 2000 and directed by James Cameron? [/INST]
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the titles of all movies that James Cameron directed after 2000? [/INST]
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many movies were made before 2000? [/INST]
SELECT count(*) FROM Movie WHERE YEAR < 2000;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many movies were made before 2000? [/INST]
SELECT count(*) FROM Movie WHERE YEAR < 2000;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Who is the director of movie Avatar? [/INST]
SELECT director FROM Movie WHERE title = 'Avatar';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Who directed Avatar? [/INST]
SELECT director FROM Movie WHERE title = 'Avatar';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many reviewers listed? [/INST]
SELECT count(*) FROM Reviewer;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many reviewers are there? [/INST]
SELECT count(*) FROM Reviewer;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the id of the reviewer whose name has substring “Mike”? [/INST]
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the id of the reviewer whose name includes the word "Mike"? [/INST]
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the reviewer id of Daniel Lewis? [/INST]
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the id of the reviewer named Daniel Lewis? [/INST]
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the total number of ratings that has more than 3 stars? [/INST]
SELECT count(*) FROM Rating WHERE stars > 3;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many movie ratings have more than 3 stars? [/INST]
SELECT count(*) FROM Rating WHERE stars > 3;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the lowest and highest rating star? [/INST]
SELECT max(stars) , min(stars) FROM Rating;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the maximum and mininum number of stars a rating can receive? [/INST]
SELECT max(stars) , min(stars) FROM Rating;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year. [/INST]
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently? [/INST]
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of directors who directed movies with 5 star rating? Also return the title of these movies. [/INST]
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate 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? [/INST]
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the average rating star for each reviewer? [/INST]
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the average number of stars that each reviewer awards for a movie? [/INST]
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the titles of all movies that have no ratings. [/INST]
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the titles of all movies that have not been rated? [/INST]
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the names of all reviewers who have ratings with a NULL value for the date. [/INST]
SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the different names of all reviewers whose ratings do not have a date field? [/INST]
SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null";
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the average rating stars and title for the oldest movie? [/INST]
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);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For the oldest movie listed, what is its average rating and title? [/INST]
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);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the name of the most recent movie? [/INST]
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the title of the newest movie? [/INST]
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the maximum stars and year for the most recent movie? [/INST]
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);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is highest rating for the most recent movie and when was it released? [/INST]
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);
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the names of movies whose created year is after all movies directed by Steven Spielberg? [/INST]
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg");
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all movies that were created after the most recent Steven Spielberg film? [/INST]
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg");
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate 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...
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");
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating? [/INST]
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");
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Return reviewer name, movie title, stars, and ratingDate. And sort the data first by reviewer name, then by movie title, and lastly ...
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What is the reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then fi...
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the names of all reviewers who have contributed three or more ratings. [/INST]
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all reviewers that have rated 3 or more movies? [/INST]
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the names of all reviewers who rated Gone with the Wind. [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all the different reviewers who rates Gone with the Wind? [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the names of all directors whose movies are rated by Sarah Martinez. [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all directors whose movies have been reviewed by Sarah Martinez? [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate 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 numbe...
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director...
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Return all reviewer names and movie names together in a single list. [/INST]
SELECT name FROM Reviewer UNION SELECT title FROM Movie;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all the reviewers and movie names? [/INST]
SELECT name FROM Reviewer UNION SELECT title FROM Movie;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the titles of all movies not reviewed by Chris Jackson. [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the titles of all movies that were not reviewed by Chris Jackson? [/INST]
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';
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For all directors who directed more than one movie, return the titles of all movies directed by them, along with the director name. ...
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For all directors who have directed more than one movie, what movies have they directed and what are their names? [/INST]
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For directors who had more than one movie, return the titles and produced years of all movies directed by them. [/INST]
SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For each director who directed more than one movie, what are the titles and dates of release for all those movies? [/INST]
SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of the directors who made exactly one movie? [/INST]
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all directors who made one movie? [/INST]
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of the directors who made exactly one movie excluding director NULL? [/INST]
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the names of all directors who have made one movie except for the director named NULL? [/INST]
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: How many movie reviews does each director get? [/INST]
SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: For each director, how many reviews have they received? [/INST]
SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: Find the movies with the highest average rating. Return the movie titles and average rating. [/INST]
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the movie titles with the highest average rating and what are those ratings? [/INST]
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the movie titles and average rating of the movies with the lowest average rating? [/INST]
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;
Tables: Movie, Reviewer, Rating Columns: Movie.mID, Movie.title, Movie.year, Movie.director, Reviewer.rID, Reviewer.name, Rating.rID, Rating.mID, Rating.stars, Rating.ratingDate Question: What are the titles and average ratings for all movies that have the lowest average rating? [/INST]
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;