Window Functions in PostgreSQL

A must-know for any data practitioner

Merlin Schäfer
Towards Data Science
8 min readJan 6, 2023

--

Photo by Stephen Dawson on Unsplash

Have you ever found yourself writing long SQL queries with many steps or subqueries containing aggregate functions to calculate seemingly simple metrics? Have you ever wondered if you “couldn’t just calculate along the table differently to make things easier”? Then it might be time to have a look at window functions.

--

--

Data Scientist at HMS Analytical Software with a psychology background. Interested in all things “data”, cloud and AI.