Created
February 7, 2020 19:43
-
-
Save florestankorp/fa10aa941fe9408d0ea4d3a7f5d370b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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. | |
-- Your query should output a table with a single column for the title of each movie. | |
-- You may assume that there is only one person in the database with the name | |
-- Chadwick Boseman. | |
SELECT title, rating | |
FROM movies | |
JOIN ratings on movies.id = ratings.movie_id | |
JOIN stars on movies.id = stars.movie_id | |
JOIN people on stars.person_id = people.id | |
WHERE name = "Chadwick Boseman" | |
ORDER BY rating DESC | |
LIMIT 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The query should output a single column table, not two. You can delete rating from the first SELECT