Most T-SQL developers recognize the value of window functions for data analysis calculation. But window functions can do far more than that, and optimizations in recent versions of SQL Server have made them more powerful than ever. In T-SQL Window Functions: For Data Analysis and Beyond, renowned T-SQL expert Itzik Ben-Gan introduces breakthrough techniques for using window functions to handle many common T-SQL querying tasks with unprecedented elegance and power.
Ben-Gan first explains why window functions can often be a far better solution than traditional predicate-based approaches. Next, using extensive code examples, he guides you through each type of window function: Aggregate, Ranking, Distribution and Offset. You’ll find detailed coverage of ordered set functions (including SQL Server 2017’s STRING_AGG); plus an extensive section on optimization. The book concludes with roughly 100 pages of real T-SQL solutions using window function approaches — including techniques invented by the author and available in no other book.
About the Author
Itzik Ben-Gan (United States; Microsoft Data Platform MVP since 1999) is a Mentor and Co-Founder of SolidQ. He has delivered numerous training events around the world focused on T-SQL querying, query tuning, and programming. The author of several books, including T-SQL Fundamentals, 3rd Edition and T-SQL Querying, he has also written for SentryOne's sqlperformance.com, SQL Server Pro, and SolidQ. His speaking activities include SQLPASS, SQLBits, and various events and user groups around the world. He developed SolidQ's Advanced T-SQL Querying, Programming and Tuning and T-SQL Fundamentals courses, and is a primary resource for the company's T-SQL related activities.
Table of Contents
1. SQL Windowing
2. A Detailed Look at Window Functions
3. Ordered Set Functions
4. Optimization of Window Functions
5. T-SQL Solutions Using Window Functions