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

Instruction

Perfect! Let's continue our adventure. In Part 3, we introduced PARTITION BY, which we used to show window functions for groups of rows rather than all rows in the query result. Take a look:

SELECT
  first_name,
  last_name,
  country,
  COUNT(id) OVER(PARTITION BY country)
FROM customer;

The above query shows the data about each customer along with the count of customers from the same country.

Exercise

For each movie, show its title, editor_rating, genre and the average editor_rating of all movies of the same genre.

Stuck? Here's a hint!

You will need to partition by the genre.