Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quick refresher
4. Scope of this part
PARTITION BY ORDER BY with window frames
PARTITION BY ORDER BY with analytical functions


Alright. Before we get down to real work, let's explain what we'll actually teach you today.

In Part 3, you learned what PARTITION BY is. It allows you to compute certain functions independently for groups of rows and still maintain their individual character.

In Part 3, we only used PARTITION BY with the aggregate functions which you had known before: AVG(), COUNT(), MAX(), MIN(), SUM(). None of these functions required the use of ORDER BY: the order of rows simply doesn't matter in this case.

However, in part 4,5 and 6, you got to know new elements where the order does matter: ranking functions, window frames and analytical functions.

In this part, we'll teach you how to use PARTITION BY with these new elements. Each time, you will also need an ORDER BY clause – hence the name of the part: PARTITION BY ORDER BY. Remember to keep the order: PARTITION BY comes before ORDER BY, or it simply won't make any sense.


Press Next exercise to continue.