Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Get to know tables
4. Introducing window functions
Computations with OVER()
Aggregate functions with OVER()


Ok, now that you know the tables, we can finally get down to work.

What is a window function exactly? It is a function that performs calculations across a set of table rows. The rows are somehow related to the current row.

For example, with window functions you can compute sum of values in the current row, one before and one after, as in the picture:


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

[window_function] OVER (...)

[window_function] can be an aggregate function that you already know (COUNT(), SUM(), AVG() etc.), or another function, such as a ranking or an analytical function that you'll get to know in this course.

The window frame is defined in the OVER(...) clause. The large part of the course explains how to define the window frame with OVER(...). This is what we're going to talk about in the next exercise.


Press Next exercise to continue the explanation.