Checkpoint 30.6.2.
Write a query to find the average IMDB score for all the movies.
movies
and actors
. We will be using the movie
table (so queries will look like SELECT * from movies
). It features the following columns of data:Column Name | Description |
---|---|
id | A unique number for each record |
imdb_id | The id of the movie in the Internet Movie DataBase (IMDB) |
title | Title fo the movie |
director | Name of the director |
year | Year (number) the movie was released |
rating | Rating (R, PG, etc…) |
genres | Comma-separated list of genres |
runtime | Length in minutes |
country | Comma separated list of countries it was released in |
language | Comma separated list of languages it was released in |
imdb_score | Score of the movie (1-10) in IMDB |
imdb_votes | Number of ratings for the movie in the IMDB |
metacritic_score | Score of the movie (1-100) on the Metacritic website |
director LIKE '%Quentin Tarantino%'
to identify movies where Quentin Tarantino is in the list of directors.)GROUP BY
to write a query to display each rating
category with the number of movies in that category. Your output should look like this:... PG | 43 PG-13 | 32 ...
director
with the highest (MAX
) imdb_score
that director’s movies have earned. Order the output so the directors with the highest imdb_score
come first.director | score Frank Darabont | 9.3 Francis Ford Coppola | 9.2 ...
director
with the COUNT
of the number of films they have made. But only retrieve the data for directors with at least 2 films.ORDER BY
).HAVING
to filter grouped results.director | num_films Akira Kurosawa | 5 Alfred Hitchcock | 6 ...
director
with the number of movies they have made that have an imdb_score
of greater than 8.5.WHERE
not a HAVING
.director | high_rated_films Peter Jackson | 3 Christopher Nolan | 3 Steven Spielberg | 2 ...
actors
table. It consists of records that match a movie to a particular actor. If an actor appears in multiple movies, they will appear in one record for each movie they appear in.Column Name | Description |
---|---|
id | A unique number for each record |
movie_id | The id of the movie the actor appears in. This will match the id field in the movies table. |
imdb_id | ID of the actor on the IMDB website |
name | Name of the actor |
movies.title
from the results of joining the actors
table with the movies
table (so that actors.movie_id
matches with movies.id
) and selecting rows in which the actors.name
is "Marlon Brando"
.title Apocalypse Now On the Waterfront The Godfather
actor.name
with the highest metacritic_score
of any movie that actor has been in (we won’t know what movie the score is from).actors
and movies
so that you have access to all the needed data. You will also have to use GROUP BY
. The GROUP BY
should come after the JOIN
.name | max_metacritic A.B. Lane | 0 A.J. O'Connor | 0 A.K. Hangal | 84 A.R. Haysel | 87 A.S. Duggal | 67 ...