OVER clause

A window function computes a value for each row from a set of related rows, defined by the OVER clause, without reducing the number of rows the way GROUP BY would. It enables rankings, running totals and comparisons with the previous row, while keeping the detail.

Example

SELECT nom, prix, AVG(prix) OVER () AS prix_moyen FROM produits;

Related concepts

The whole glossary