SQL
stringlengths
18
577
question
stringlengths
317
11.5k
SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. which poll source does the highest oppose rate come from?
SELECT poll_source FROM candidate ORDER BY oppose_rate DESC LIMIT 1
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Return the poll source corresponding to the candidate who has the oppose rate.
SELECT name FROM people ORDER BY date_of_birth
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. List all people names in the order of their date of birth from old to young.
SELECT name FROM people ORDER BY date_of_birth
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of all people, ordered by their date of birth?
SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M'
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Find the average height and weight for all males (sex is M).
SELECT avg(height) , avg(weight) FROM people WHERE sex = 'M'
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the average height and weight across males (sex is M)?
SELECT name FROM people WHERE height > 200 OR height < 190
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. find the names of people who are taller than 200 or lower than 190.
SELECT name FROM people WHERE height > 200 OR height < 190
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of people who have a height greater than 200 or less than 190?
SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Find the average and minimum weight for each gender.
SELECT avg(weight) , min(weight) , sex FROM people GROUP BY sex
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the average and minimum weights for people of each sex?
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Find the name and gender of the candidate who got the highest support rate.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What is the name and sex of the candidate with the highest support rate?
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Find the name of the candidates whose oppose percentage is the lowest for each sex.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. For each sex, what is the name and sex of the candidate with the oppose rate for their sex?
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. which gender got the highest average uncertain ratio.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What is the sex of the candidate who had the highest unsure rate?
SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate)
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. what are the names of people who did not participate in the candidate election.
SELECT name FROM people WHERE people_id NOT IN (SELECT people_id FROM candidate)
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Give the names of people who did not participate in the candidate election.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Find the names of the candidates whose support percentage is lower than their oppose rate.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of candidates who have a lower support rate than oppose rate?
SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. how many people are there whose weight is higher than 85 for each gender?
SELECT count(*) , sex FROM people WHERE weight > 85 GROUP BY sex
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Count the number of people of each sex who have a weight higher than 85.
SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. find the highest support percentage, lowest consider rate and oppose rate of all candidates.
SELECT max(support_rate) , min(consider_rate) , min(oppose_rate) FROM candidate
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. Return the maximum support rate, minimum consider rate, and minimum oppose rate across all candidates?
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. list all female (sex is F) candidate names in the alphabetical order.
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
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of all female candidates in alphabetical order (sex is F)?
SELECT name FROM people WHERE height < (SELECT avg(height) FROM people)
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. find the name of people whose height is lower than the average.
SELECT name FROM people WHERE height < (SELECT avg(height) FROM people)
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of people who are shorter than average?
SELECT * FROM people
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. List all info about all people.
SELECT * FROM people
Given the Table candidate having columns as Candidate_ID has datatype number, People_ID has datatype number, Poll_Source has datatype text, Date has datatype text, Support_rate has datatype number, Consider_rate has datatype number, Oppose_rate has datatype number, Unsure_rate has datatype number which has Candidate_ID and Given the Table people having columns as People_ID has datatype number, Sex has datatype text, Name has datatype text, Date_of_Birth has datatype text, Height has datatype number, Weight has datatype number which has People_ID. Answer the question by writing the appropriate SQL code. What is all the information about all people?
SELECT title FROM Movie WHERE director = 'Steven Spielberg'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the titles of all movies directed by steven spielberg.
SELECT title FROM Movie WHERE director = 'Steven Spielberg'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all movies directed by Steven Spielberg?
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the movie produced after 2000 and directed by James Cameron?
SELECT title FROM Movie WHERE director = 'James Cameron' AND YEAR > 2000
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the titles of all movies that James Cameron directed after 2000?
SELECT count(*) FROM Movie WHERE YEAR < 2000
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many movies were made before 2000?
SELECT director FROM Movie WHERE title = 'Avatar'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Who is the director of movie Avatar?
SELECT director FROM Movie WHERE title = 'Avatar'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Who directed Avatar?
SELECT count(*) FROM Reviewer
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many reviewers listed?
SELECT count(*) FROM Reviewer
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many reviewers are there?
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the id of the reviewer whose name has substring “Mike”?
SELECT rID FROM Reviewer WHERE name LIKE "%Mike%"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the id of the reviewer whose name includes the word "Mike"?
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the reviewer id of Daniel Lewis?
SELECT rID FROM Reviewer WHERE name = "Daniel Lewis"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the id of the reviewer named Daniel Lewis?
SELECT count(*) FROM Rating WHERE stars > 3
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the total number of ratings that has more than 3 stars?
SELECT count(*) FROM Rating WHERE stars > 3
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many movie ratings have more than 3 stars?
SELECT max(stars) , min(stars) FROM Rating
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the lowest and highest rating star?
SELECT max(stars) , min(stars) FROM Rating
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the maximum and mininum number of stars a rating can receive?
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order of year.
SELECT DISTINCT YEAR FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars >= 4 ORDER BY T1.year
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. In what years did a movie receive a 4 or 5 star rating, and list the years from oldest to most recently?
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of directors who directed movies with 5 star rating? Also return the title of these movies.
SELECT T1.director , T1.title FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID WHERE T2.stars = 5
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of the directors who created a movie with a 5 star rating, and what was the name of those movies?
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average rating star for each reviewer?
SELECT T2.name , avg(T1.stars) FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T2.name
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average number of stars that each reviewer awards for a movie?
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the titles of all movies that have no ratings.
SELECT title FROM Movie WHERE mID NOT IN (SELECT mID FROM Rating)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the titles of all movies that have not been rated?
SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the names of all reviewers who have ratings with a NULL value for the date.
SELECT DISTINCT name FROM Reviewer AS T1 JOIN Rating AS T2 ON T1.rID = T2.rID WHERE ratingDate = "null"
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the different names of all reviewers whose ratings do not have a date field?
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)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the average rating stars and title for the oldest 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)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For the oldest movie listed, what is its average rating and title?
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the name of the most recent movie?
SELECT title FROM Movie WHERE YEAR = (SELECT max(YEAR) FROM Movie)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the title of the newest movie?
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)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the maximum stars and year for the most recent movie?
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)
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is highest rating for the most recent movie and when was it released?
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg")
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the names of movies whose created year is after all movies directed by Steven Spielberg?
SELECT title FROM Movie WHERE YEAR > (SELECT max(YEAR) FROM Movie WHERE director = "Steven Spielberg")
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all movies that were created after the most recent Steven Spielberg film?
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")
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. 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")
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the titles and directors of all movies that have a rating higher than the average James Cameron film rating?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. 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.
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What is the reviewer name, film title, movie rating, and rating date for every movie ordered by reviewer name, movie title, then finally rating?
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the names of all reviewers who have contributed three or more ratings.
SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID = T2.rID GROUP BY T1.rID HAVING COUNT(*) >= 3
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all reviewers that have rated 3 or more movies?
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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the names of all reviewers who rated 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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all the different reviewers who rates Gone with the Wind?
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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the names of all directors whose movies are rated by 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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all directors whose movies have been reviewed by Sarah Martinez?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. 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.
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the different reviewer names, movie titles, and stars for every rating where the reviewer had the same name as the director?
SELECT name FROM Reviewer UNION SELECT title FROM Movie
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Return all reviewer names and movie names together in a single list.
SELECT name FROM Reviewer UNION SELECT title FROM Movie
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all the reviewers and movie names?
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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the titles of all movies not reviewed by 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'
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the titles of all movies that were not reviewed by Chris Jackson?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. 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.
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For all directors who have directed more than one movie, what movies have they directed and what are their names?
SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For directors who had more than one movie, return the titles and produced years of all movies directed by them.
SELECT T1.title , T1.year FROM Movie AS T1 JOIN Movie AS T2 ON T1.director = T2.director WHERE T1.title != T2.title
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For each director who directed more than one movie, what are the titles and dates of release for all those movies?
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of the directors who made exactly one movie?
SELECT director FROM Movie GROUP BY director HAVING count(*) = 1
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all directors who made one movie?
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of the directors who made exactly one movie excluding director NULL?
SELECT director FROM Movie WHERE director != "null" GROUP BY director HAVING count(*) = 1
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names of all directors who have made one movie except for the director named NULL?
SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. How many movie reviews does each director get?
SELECT count(*) , T1.director FROM Movie AS T1 JOIN Rating AS T2 ON T1.mID = T2.mID GROUP BY T1.director
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For each director, how many reviews have they received?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the movies with the highest average rating. Return the movie titles and average rating.
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the movie titles with the highest average rating and what are those ratings?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the movie titles and average rating of the movies with the lowest average rating?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the titles and average ratings for all movies that have the lowest average rating?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names and years of the movies that has the top 3 highest rating star?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. What are the names and years released for the movies with the top 3 highest ratings?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. 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.
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. For each director, what are the titles and ratings for all the movies they reviewed?
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
Given the Table movie having columns as mID has datatype number, title has datatype text, year has datatype number, director has datatype text which has mID and Given the Table reviewer having columns as rID has datatype number, name has datatype text which has rID and Given the Table rating having columns as rID has datatype number, mID has datatype number, stars has datatype number, ratingDate has datatype time which has NO_PRIMARY_KEY. Answer the question by writing the appropriate SQL code. Find the title and star rating of the movie that got the least rating star for each reviewer.