Overview
- Helps you write better performing queries using window functions
- Provides fun examples that you can experiment with in your own databases
- Explains how to get the best performance when using window functions
Access this book
Tax calculation will be finalised at checkout
Other ways to access
Table of contents (11 chapters)
Keywords
About this book
Window functions are useful in analytics and business intelligence reporting. They came into full blossom with SQL Server 2012, yet they are not as well known and used as often as they ought to be. This group of functions is one of the most notable developments in SQL, and this book shows how every developer and DBA can benefit from their expressive power in solving day-to-day business problems. Once you begin using window functions, such as ROW_NUMBER and LAG, you will discover many ways to use them. You will approach SQL Server queries in a different way, thinking about sets of data instead of individual rows. Your querieswill run faster, be easier to write, and easier to deconstruct, maintain, and enhance in the future.
Just knowing and using these functions is not enough. You also need to understand how to tune the queries. Expert T-SQL Window Functions in SQL Server clearly explains how to get the best performance. The book also covers the rare cases when older techniques are the best bet.
What You Will Learn
- Solve complex query problems without cumbersome self-joins that run slowly and are difficult to read
- Create sliding windows in a result set for computing such as running totals and moving averages
- Return aggregate and detail data simultaneously from the same SELECT statement
- Compute lag and lead and other values that access data from multiple rows in a result set
- Understand the OVER clause syntax and how to control the window
- Avoid framing errors that can lead to unexpected results
Who This Book Is For
Anyone who writes T-SQL queries, including database administrators, developers, business analysts, and data scientists. Before reading this book, you should understand how to join tables, write WHERE clauses, and build aggregate queries.
Authors and Affiliations
About the authors
Clayton Groom is a data warehouse and analytics consultant at Clayton Groom, LLC. He has worked with SQL Server for 25 years. His expertise lies in designing and building data warehouse and analytic solutions on the Microsoft technology stack, including Power BI, SQL Server, Analysis Services, Reporting Services and Excel.
Edward Pollack has over 20 years of experience in database and systems administration and architecture, developing a passion for performance optimization and making things go faster. He has spoken at many SQL Saturdays, 24 Hours of PASS, and PASS Summits, and has coordinated SQL Saturday Albany since its inception in 2014.
Bibliographic Information
Book Title: Expert T-SQL Window Functions in SQL Server 2019
Book Subtitle: The Hidden Secret to Fast Analytic and Reporting Queries
Authors: Kathi Kellenberger, Clayton Groom, Ed Pollack
DOI: https://doi.org/10.1007/978-1-4842-5197-3
Publisher: Apress Berkeley, CA
eBook Packages: Professional and Applied Computing, Apress Access Books, Professional and Applied Computing (R0)
Copyright Information: Kathi Kellenberger, Clayton Groom, and Ed Pollack 2019
Softcover ISBN: 978-1-4842-5196-6Published: 22 October 2019
eBook ISBN: 978-1-4842-5197-3Published: 21 October 2019
Edition Number: 2
Number of Pages: XVIII, 213
Number of Illustrations: 123 b/w illustrations
Topics: Database Management, Programming Languages, Compilers, Interpreters, Microsoft and .NET