Use the imdb
database to answer the following questions.
Count the number of movies in each production year.
Find the total number of votes cast for movies in each year since 2000.
What is wrong with this SQL statement, and how can we correct it?
SELECT production_year, sum(votes)
FROM movies
GROUP BY production_year
HAVING votes > 100000
SELECT production_year, sum(votes)
FROM movies
GROUP BY votes
HAVING votes > 100000
Compute the average rating of movies in 2000 and 2010.
Find the movie id for The Dark Knight.
Using the id
you found in the previous question, find all of the cast assignments for The Dark Knight.
Add the names of the people you found in the previous question by joining onto the people
table.
Add the names of the roles you found in the previous question by joining onto the role_type
table.
How many actors, actresses, and directors where there for The Dark Knight? Find all three numbers using one query.
Identify the five actors who played more than one role in The Dark Knight, and list the roles?
The Godfather trilogy consists of three movies: The Godfather, The Godfather: Part II, and The Godfather: Part III. Find the IDs of all three movies.
List the movie title, person name, and role for all those involved with the original The Godfather movie.
List the movie title, person name, and role for all those involved with the first two Godfather movies.
Hint: One way to do this is with INTERSECT. There are other ways!
Challenge: Do this without using INTERSECT!