Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Quick Refresher
4. Introduction
PARTITION BY ORDER BY with Window Frames
Using PARTITION BY ORDER BY with Analytical Functions
Summary and Review


Before we get down to work, let's explain what you'll learn 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 familiar aggregate functions: 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. You will need an ORDER BY clause – hence the name of this part. Remember to use the proper order: PARTITION BY comes before ORDER BY. Otherwise, your query won't make sense.


Click Next exercise to continue.