Skip to content
/ Chapter 17 · Guided Playground Missions
Lesson 17.3 · movie_rentals
Lesson 17.3

SQL Playground Mission: Movie Genre Scorecard

Turn rental history into a genre scorecard with counts and revenue.

A scorecard compresses transaction rows into a ranked view of performance. Here, each rental row contributes activity and revenue, while the movie table supplies the genre used for grouping.

The HAVING clause keeps the report focused on genres with enough activity to compare. That is a common playground move: group broadly, then tighten the report once you can see the shape of the data.

Pattern
select dimension,
       count(*) as activity,
       round(sum(amount), 2) as revenue
from fact_table
join dimension_table using (dimension_id)
group by dimension
having count(*) >= 3
order by revenue desc, dimension
Schema · Movie Rentals Table · rentals 6 columns · 26 rows
Table · rentals

One row per rental. Movies still out have a null returned_date.

6 columns · 26 rows
rental_id int customer_id int movie_id int rental_date date returned_date date amount decimal
Schema 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

Build a genre scorecard. Return genre, rentals, and revenue for genres with at least 3 rentals. Sort by revenue descending, then genre.

·

Run your query to inspect the result.

Expected answer
  • Columns: genre, rentals, revenue.
  • Rows: genres with at least 3 rentals.
  • Thriller leads with 6 rentals and 29.94 revenue.