22-25 April 2026
Video unavailable
SQLBits 2022

Windowing Functions - A simple secret for making your data more beautiful

Windowing Functions are an underappreciated part of SQL Server. In this session we'll start with the absolute basics of windowing functions, but quickly ramp into the advanced analytical and query enhancing properties of these functions.
One of the simplest ways to enhance the value of the information we provide is to add context. Supplementing each data point with information from a larger data set is a common way of adding this context. In T-SQL, we achieve this by using Windowing Functions. In this demo-heavy session, we will walk through the uses of Windowing Functions, from simple row orders to more complicated calculations like rolling averages. We’ll explore each keyword in turn, building more sophisticated functions as we do. Each concept is illustrated in a visual, and T-SQL example so it is clearly understood. So whether it’s tracking a value against the previous row, creating running totals, or a rolling sum, when you walk out of this session, you’ll be able to write a windowing function to make it happen.