Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Simple OVER()
PARTITION BY
Ranking functions
Window frame
Analytic functions
ORDER BY PARTITION BY
27. PARTITION BY ORDER BY – Summary
Order of evaluation
Summary

Instruction

Remember the previous part, part 7? This is where we combined ORDER BY with PARTITION BY:

SELECT
  title,
  release_year,
  LEAD(title) OVER(PARTITION BY genre ORDER BY release_year)
FROM movie;

In the above example, the last column will show the next movie that was released with the same genre.

Exercise

For each movie, show its title, genre, editor_rating and its rank based on editor_rating for all the movies in the same genre.

Stuck? Here's a hint!

You'll need PARTITION BY genre ORDER BY editor_rating DESC.