-- Q1: Find the titles of all movies directed by Steven Spielberg order the titles alphabetically.
-- Put your SQL for Q1 below.  Be sure to leave a blank line below your answer.


-- Q2: Find all years that have a movie that received a rating of 4 or 5, and sort them in increasing order.   A given year should not appear more than once.
-- Put your SQL for Q2 below.  Be sure to leave a blank line below your answer.


-- Q3: Write a query to return the ratings data in a more readable format: reviewer name, movie title, stars, and ratingDate. Also, sort the data, first by reviewer name, then by movie title, and lastly by number of stars, all in ascending order.
-- Put your SQL for Q3 below.  Be sure to leave a blank line below your answer.


-- Q4: Find titles of movies that have no ratings.
-- Put your SQL for Q4 below.  Be sure to leave a blank line below your answer.


-- Q5: Find the movie titles of all movies that have not received a rating of at least 4 stars.  Your result should include movies that have not received any ratings.
-- Put your SQL for Q5 below.  Be sure to leave a blank line below your answer.


-- Q6: Find titles of movies that have been reviewed by both Elizabeth Thomas and James Cameron.
-- Put your SQL for Q6 below.  Be sure to leave a blank line below your answer.


-- Q7: Find names of reviewers who have reviewed movies from before 1960 or whose titles start with the letter A.
-- Put your SQL for Q7 below.  Be sure to leave a blank line below your answer.


-- Q8: Find titles of movies directed by a director with a first name of George or receiving >= 4 stars by some reviewer.  (Be sure to check your query produces the correct answer on this database!)
-- Put your SQL for Q8 below.  Be sure to leave a blank line below your answer.


-- Q9: For each movie that has at least one rating, find the highest number of stars that movie received. Return the movie title and number of stars (maxStars). Order alphabetically by movie title.
-- Put your SQL for Q9 below.  Be sure to leave a blank line below your answer.


-- Q10: For each movie that received at least one rating, find the title along with the number of ratings (numRatings) it has received.
-- Put your SQL for Q10 below.  Be sure to leave a blank line below your answer.


-- Q11: For each movie that received at least one rating, find the title along with the number of reviewers (numReviewers) that have reviewed it.  Be careful: avoid conflating two movies with the same name.
-- Put your SQL for Q11 below.  Be sure to leave a blank line below your answer.


-- Q12: For each movie that has at least one rating, return the title and the rating spread, that is, the difference between highest and lowest ratings given to that movie. Order by rating spread from highest to lowest, then by movie title alphabetically.
-- Put your SQL for Q12 below.  Be sure to leave a blank line below your answer.


-- Q13: For each movie that has at least one rating, the title, the director and its highest rating.  The highest rating should be an attribute called maxStars.
-- Put your SQL for Q13 below.  Be sure to leave a blank line below your answer.


-- Q14: For each movie that has at least one rating, the title, the director and its highest rating only for those movies whose highest rating (maxStars) is at most 4.
-- Put your SQL for Q14 below.  Be sure to leave a blank line below your answer.


-- Q15: Find the number of movies (numMovies) that Steven Spielberg has directed whose highest rating is at least 3.  Hint: use an earlier query as a subquery in the FROM clause.
-- Put your SQL for Q15 below.  Be sure to leave a blank line below your answer.


-- Q16: Find the average rating (avgStars) of movies released after 1980. (Keep in mind that some movies have been reviewed more than once.  So make sure to calculate the average rating for each movie, and THEN the average of those averages.)
-- Put your SQL for Q16 below.  Be sure to leave a blank line below your answer.


-- Q17: (Challenging!) For each director, return the director's name together with the title(s) of the movie(s) they directed that received the highest rating (maxStars) among all of their movies, and the value of that rating.
-- Put your SQL for Q17 below.  Be sure to leave a blank line below your answer.


-- End of file. Do not delete this line.
