Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Get to know the data
Get to know the OVER() clause
4. Introducing Window Functions
Computations with OVER()
Aggregate functions with OVER()
Using OVER() with WHERE
Summary

Instruction

Now that you know the tables, we can start learning about window functions.

A window function performs calculations across a set of table rows. These rows are related to the current row.

For example, with window functions you can compute the sum of values in the current row, the row before, and the row after. We've illustrated that in this picture:

Animated explanation

We call these window functions because the set of rows is called a window or a window frame. Take a look at the general syntax:

<WindowFunction> OVER (...)

The <WindowFunction> can be an aggregate function that you already know (COUNT(), SUM(), AVG(), etc.). It can be another function, such as a ranking function or an analytical function. You'll get to know more analytical functions in this course.

The window frame is defined in the OVER(...) clause. The majority of this course will explain how to define the window frame with OVER(...).

Exercise

Click Next exercise to continue.