OVER

The clause that makes a function a window function and defines which rows it can see and in what order.

In more detail

An empty OVER () sees the whole result. OVER (PARTITION BY customer_id) sees only the rows of the current customer. OVER (ORDER BY id) by default sees rows from the first up to the current one in id order, which gives a running total.

Example

SUM(id) OVER (ORDER BY id) AS running_id_sum

Related terms

Taught in

References