0% found this document useful (0 votes)
44 views

IMDB-SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

IMDB-SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

You’re welcome to check your queries’ results against IMDb itself, but realize that

ratings on the website might differ from those in movies.db , as more votes might have
been cast since we downloaded the data!

1. In 1.sql , write a SQL query to list the titles of all movies released in 2008.
o Your query should output a table with a single column for the title
of each movie.
2. In 2.sql , write a SQL query to determine the birth year of Emma Stone.
o Your query should output a table with a single column and a single
row (plus optional header) containing Emma Stone’s birth year.
o You may assume that there is only one person in the database with
the name Emma Stone.
3. In 3.sql , write a SQL query to list the titles of all movies with a release date on
or after 2018, in alphabetical order.
o Your query should output a table with a single column for the title
of each movie.
o Movies released in 2018 should be included, as should movies with
release dates in the future.
4. In 4.sql , write a SQL query to determine the number of movies with an IMDb
rating of 10.0.
o Your query should output a table with a single column and a single
row (plus optional header) containing the number of movies with a
10.0 rating.
5. In 5.sql , write a SQL query to list the titles and release years of all Harry Potter
movies, in chronological order.
o Your query should output a table with two columns, one for the
title of each movie and one for the release year of each movie.
o You may assume that the title of all Harry Potter movies will begin
with the words “Harry Potter”, and that if a movie title begins with
the words “Harry Potter”, it is a Harry Potter movie.
6. In 6.sql , write a SQL query to determine the average rating of all movies
released in 2012.
o Your query should output a table with a single column and a single
row (plus optional header) containing the average rating.
7. In 7.sql , write a SQL query to list all movies released in 2010 and their ratings,
in descending order by rating. For movies with the same rating, order them
alphabetically by title.
o Your query should output a table with two columns, one for the
title of each movie and one for the rating of each movie.
o Movies that do not have ratings should not be included in the
result.
8. In 8.sql , write a SQL query to list the names of all people who starred in Toy
Story.
o Your query should output a table with a single column for the name
of each person.
o You may assume that there is only one movie in the database with
the title Toy Story.
9. In 9.sql , write a SQL query to list the names of all people who starred in a
movie released in 2004, ordered by birth year.
o Your query should output a table with a single column for the name
of each person.
o People with the same birth year may be listed in any order.
o No need to worry about people who have no birth year listed, so
long as those who do have a birth year are listed in order.
o If a person appeared in more than one movie in 2004, they should
only appear in your results once.
10. In 10.sql , write a SQL query to list the names of all people who have directed a
movie that received a rating of at least 9.0.
o Your query should output a table with a single column for the name
of each person.
11. In 11.sql , write a SQL query to list the titles of the five highest rated movies (in
order) that Chadwick Boseman starred in, starting with the highest rated.
o Your query should output a table with a single column for the title
of each movie.
o You may assume that there is only one person in the database with
the name Chadwick Boseman.
12. In 12.sql , write a SQL query to list the titles of all movies in which both Johnny
Depp and Helena Bonham Carter starred.
o Your query should output a table with a single column for the title
of each movie.
o You may assume that there is only one person in the database with
the name Johnny Depp.
o You may assume that there is only one person in the database with
the name Helena Bonham Carter.
13. In 13.sql , write a SQL query to list the names of all people who starred in a
movie in which Kevin Bacon also starred.
o Your query should output a table with a single column for the name
of each person.
o There may be multiple people named Kevin Bacon in the database.
Be sure to only select the Kevin Bacon born in 1958.
o Kevin Bacon himself should not be included in the resulting list.

You might also like