-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7.sql
More file actions
22 lines (14 loc) · 705 Bytes
/
7.sql
File metadata and controls
22 lines (14 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
SELECT movies.title, ratings.rating
FROM movies
JOIN ratings ON movies.id = ratings.movie_id
WHERE movies.year = 2010
ORDER BY ratings.rating DESC, movies.title ASC;
-- 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.
-- Your query should output a table with two columns, one for the title of each movie and one for the rating of each movie.
-- Movies that do not have ratings should not be included in the result.
select title
from movies
join ratings on ratings.movie_id = movies.id
where movies.year = 2010
order by ratings.rating DESC, movies.title ASC;