Window functions in SQL Server - brush up your skills
Proposed session for SQLBits 2026TL; DR
Wether you're a newbie or a seasoned developer, now is the time to brush up your window function skills. Get to know this "advanced" toolset in order to ease and optimize the development of your data analysis queries in T-SQL.
Session Details
Window functions usually are considered "advanced SQL", and while they're part of the language standard, SQL Server does not implement all of them. Version 2022 brought at least a small feature update worth looking at and in 2025 we get a new aggregate function, so it's about time time to brush up our knowledge.
You will learn when and how how to use those OVER, PARTITION and ORDER clauses. From aggregate and ranking to statistical and offset functions, this session walks you through all that SQL Server offers, up to the new actual WINDOW clause. The demos will show real world applications, such as sliding means, running totals, string aggregates and even the popular "gaps and islands" problem.
Once you've got the hang of it (right after this session), it will become clear that window functions are not overly complicated, but ease the development of data analysis in T-SQL, and in the optimal case even bring a performance advantage over conventional methods.
You will learn when and how how to use those OVER, PARTITION and ORDER clauses. From aggregate and ranking to statistical and offset functions, this session walks you through all that SQL Server offers, up to the new actual WINDOW clause. The demos will show real world applications, such as sliding means, running totals, string aggregates and even the popular "gaps and islands" problem.
Once you've got the hang of it (right after this session), it will become clear that window functions are not overly complicated, but ease the development of data analysis in T-SQL, and in the optimal case even bring a performance advantage over conventional methods.
3 things you'll get out of this session
- Get acquainted with, or brush up your window function skills
- Learn what works in SQL Server and what doesn't, window-wise
- Build up confidence in using window functions for optimal queries
Speakers
Thomas Hütter's previous sessions
A journey through the Tidyverse
An introduction to the philosophy of tidy data and the collection of R packages called Tidyverse that help to treat your data appropriately. Including lots of demos from ingesting to cleaning to visualizing your data.
An R primer for SQL folks
A walk-through on what is possible analyzing your data with the "R" language.
50 ways to show your data
„A picture is worth a thousand words“ - compelling visualizations beyond the usual bar, line or scatter plots, produced with the help of the ggplot2 package and friends.