Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Simple OVER()
PARTITION BY
11. PARTITION BY – Review and Exercise 1
Ranking functions
Window Frames
Analytic Functions
PARTITION BY ORDER BY
Order of Evaluation
Finished!

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
  FirstName,
  LastName,
  Country,
  COUNT(Id) OVER(PARTITION BY Country) AS CustomerNumber
FROM Customer;

The above query shows the data for each customer and the count of customers from the same country.

Exercise

For each movie, show its Title, EditorRating, Genre and the AvgEditorRating of all movies of the same Genre.

Stuck? Here's a hint!

You will need to partition by Genre.