Introduction
Simple OVER()
PARTITION BY
Ranking functions
18. Ranking functions – Exercise 4
Window frame
Analytic functions
ORDER BY PARTITION BY
Order of evaluation
Summary

Instruction

Excellent. Ok, the last exercise.

Exercise

For each single rental, show the rental_date, the title of the movie rented, its genre, the payment_amount and the rank of the rental in terms of the price paid (the most expensive rental should have rank = 1). The ranking should be created separately for each movie genre. Allow the same rank for multiple rows and allow gaps in numbering too.

Stuck? Here's a hint!

You'll need to join two tables: movie and single_rental. Partition the rows by the genre, but sort them by payment_amount in the descending order.

Console

Code editor

Result

TableConsole