Skip to content

Home / Glossary / Window Function

SQL

Window Function

By Sitraka Forler · Lecturer, Durham Business SchoolUpdated 13 September 2026 About this site

Performs a calculation across rows related to the current row.

Window functions (OVER clause) do not collapse rows like GROUP BY. They add a computed column alongside existing data. Key functions: ROW_NUMBER, RANK, SUM, AVG, LAG, LEAD.

Example

AVG(close) OVER (PARTITION BY ticker ORDER BY date ROWS BETWEEN 19 PRECEDING AND CURRENT ROW)

Practise Window Function hands-on - free, in your browser

Related terms