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:

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(...)
.