Everyday Data Science
Latest
Agentic workflows now power a third of surveyed enterprise automationAfrica's AI startup ecosystem posts record funding yearNew benchmark results reshape the coding-agent leaderboardNigeria launches national AI strategy with major investment planRwanda's sovereign AI cloud enters public betaThe future of AI agents: from tools to teammates
All cheat sheets

SQL Window Functions: Keep the Rows, Add the Context

A practical reference for choosing and checking SQL window functions: totals within a group, running totals, previous-row comparisons, ranking and share-of-total calculations. Includes the five questions that prevent most window mistakes—partition, order, frame, deterministic tie-breaking and filtering—plus the reminder that window ORDER BY does not sort final output. Verified against PostgreSQL 18 and DuckDB documentation: https://www.postgresql.org/docs/18/tutorial-window.html and https://duckdb.org/docs/stable/sql/functions/window_functions

SQL Window Functions: Keep the Rows, Add the Context

By Ibrahim Denis Fofanah