Skip to content
/ Chapter 12 · Applied Practice: Movie Rentals
Lesson 12.1 · movie_rentals
Lesson 12.1

SQL Practice: Filtering and Sorting a Movie Catalog

Same skills, new shelves: put SELECT, WHERE, and ORDER BY to work on a movie catalog.

Most of the last eleven chapters ran on the Garden Shop. This chapter hands you a brand-new dataset: a small Movie Rentals shop, so you can prove the skills transfer to data you have never seen. Nothing new to learn here: just the same tools on a fresh problem.

The movies table has one row per film, with a genre, a release_year, and a numeric rating. That is everything a top-rated list needs.

Filter first, then sort

A ranked shortlist is two steps: keep the rows you care about with WHERE, then arrange them with ORDER BY. When several rows share the top value, add a second sort column so the order is stable every time the query runs.

Pattern
select columns
from table_name
where condition
order by sort_column desc, tie_breaker
Schema · Movie Rentals Table · movies 5 columns · 12 rows
Table · movies

One row per movie in the catalog.

5 columns · 12 rows
movie_id int title text genre text release_year int rating decimal
Your task

From movies, return the title, genre, release year, and rating for every film rated 8.0 or higher, highest rating first. Break ties by title.

·

Run your query to inspect the result.

Expected answer
  • Columns: title, genre, release_year, rating.
  • Rows: 4 movies rated 8.0 or higher.
  • The first row should be Paper Lanterns at 8.7.