CHAPTER 1

SQL Windowing

Window functions can help solve a wide variety of querying tasks by helping you express set calculations more easily, intuitively, and efficiently than ever before. Window functions are functions applied to sets of rows defined by a clause called OVER. They are used mainly for analytical purposes, allowing you to calculate running totals, calculate moving averages, identify gaps and islands in your data, handle intervals, and perform many other computations. These functions are based on an amazingly profound concept in the ISO/IEC SQL standard—the concept of windowing. The idea behind windowing is to allow you to apply various calculations to a set, or window, of rows and return a single value.

Window functions have evolved ...

Get T-SQL Window Functions: For data analysis and beyond, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.