Database: movie_1

Question: For each director, return the director's name together with the title of the movie they directed that received the highest rating among all of their movies, and the value of that rating. Ignore movies whose director is NULL.
SQL: SELECT T2.title ,  T2.director ,  max(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE director != "null" GROUP BY director

Question: Find the title and star rating of the movie that got the least rating star for each reviewer.
SQL: SELECT T2.title ,  T1.rID ,  T1.stars ,  min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID GROUP BY T1.rID

Question: Find the title and score of the movie with the lowest rating among all movies directed by each director.
SQL: SELECT T2.title ,  T1.stars ,  T2.director ,  min(T1.stars) FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID GROUP BY T2.director

Question: What is the name of the movie that is rated by most of times?
SQL: SELECT T2.title ,  T1.mID FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID GROUP BY T1.mID ORDER BY count(*) DESC LIMIT 1

Question: What are the titles of all movies that have rating star is between 3 and 5?
SQL: SELECT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID WHERE T1.stars BETWEEN 3 AND 5

Question: Find the names of reviewers who had given higher than 3 stars ratings.
SQL: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  >  3

Question: Find the average rating star for each movie that are not reviewed by Brittany Harris.
SQL: SELECT mID ,  avg(stars) FROM Rating WHERE mID NOT IN (SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T2.name  =  "Brittany Harris") GROUP BY mID

Question: What are the ids of the movies that are not reviewed by Brittany Harris.
SQL: SELECT mID FROM Rating EXCEPT SELECT T1.mID FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T2.name  =  "Brittany Harris"

Question: Find the average rating star for each movie that received at least 2 ratings.
SQL: SELECT mID ,  avg(stars) FROM Rating GROUP BY mID HAVING count(*)  >=  2

Question: find the ids of reviewers who did not give 4 star.
SQL: SELECT rID FROM Rating EXCEPT SELECT rID FROM Rating WHERE stars  =  4

Question: What are names of the movies that are either made after 2000 or reviewed by Brittany Harris?
SQL: SELECT DISTINCT T2.title FROM Rating AS T1 JOIN Movie AS T2 ON T1.mID  =  T2.mID JOIN Reviewer AS T3 ON T1.rID  =  T3.rID WHERE T3.name  =  'Brittany Harris' OR T2.year  >  2000

Question: What are names of the movies that are either made before 1980 or directed by James Cameron?
SQL: SELECT title FROM Movie WHERE director  =  "James Cameron" OR YEAR   <  1980

Question: What are the names of reviewers who had rated 3 star and 4 star?
SQL: SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  3 INTERSECT SELECT T2.name FROM Rating AS T1 JOIN Reviewer AS T2 ON T1.rID  =  T2.rID WHERE T1.stars  =  4