
By Steven Mandel | Article Rating: |
|
August 18, 2016 01:00 PM EDT | Reads: |
4,785 |
There is an old saying that good things come in small packages. This saying definitely applies to this book, which focuses in on a set of functions that most people are not aware of that are available in SQL Server. To start off with we need to answer the following question: What are T-SQL Window functions? These functions have nothing to do with the Microsoft Windows API. They are in essence a way to create a window into your data as you process each line in a query. Their strength lies in the ease with which you can solve tricky queries. The authors also point out that these functions don't add any new functionality per se as you could create the queries the old way; however, in general the functions are much more efficient.
One very neat capability of these functions is to allow you to include non-aggregated columns in an aggregated query, which is a big limitation with existing aggregate functions. These Window functions make it easy to calculate running totals, moving averages and more. Also starting with SQL Server 2012, you can add an order by to window aggregates to calculate running totals.
I like this book because the authors provide real-world examples that these functions can solve. Each chapter discusses some of the functions and, in many of the chapters, examples of how to solve real problems are provided. Here is a partial list of some of the examples provided.
- De-duplicating data
- Solving the island problem
- Calculating the percentage of sales
- Solving the subscription problem
- Finding gaps problem
- Creating queries where the row number starts over when a certain criteria of the data changes
There is also a well-written chapter on performance. It discusses how to determine how well these functions perform. It includes a discussion on tuning and how to understand execution plans and statistics. These give you a basic understanding of how to gauge performance.
This book is well worth having for any SQL developer wishing to expand his or her knowledge and skills but especially if you generate a lot of reports with a lot of analytical data. If you do a lot of number crunching with SQL Server, you'll want to buy this book.
Expert T-SQL Window Functions in SQL Server |
Kathi Kellenberger and Clayton Groom |
ISBN-13: 978-1484211045 |
Published August 18, 2016 Reads 4,785
Copyright © 2016 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Steven Mandel
Steven Mandel has worked in the IT industry for over 15 years designing databases using Microsoft Access and SQL Server. He has developed Web and Windows applications using VB.NET and has written numerous articles and reviews about ASP.NET and VB.NET.
![]() Dec. 30, 2017 11:00 AM EST Reads: 1,164 |
By Pat Romanski ![]() Dec. 30, 2017 08:30 AM EST Reads: 14,036 |
By Liz McMillan ![]() Dec. 29, 2017 12:00 PM EST Reads: 2,384 |
By Elizabeth White ![]() Dec. 29, 2017 08:15 AM EST Reads: 1,346 |
By Liz McMillan ![]() Dec. 29, 2017 08:00 AM EST Reads: 2,467 |
By Pat Romanski ![]() Dec. 28, 2017 02:00 PM EST Reads: 3,258 |
By Liz McMillan ![]() Dec. 24, 2017 01:45 PM EST Reads: 1,447 |
By Elizabeth White ![]() Dec. 23, 2017 10:00 AM EST Reads: 1,335 |
By Elizabeth White ![]() Dec. 22, 2017 11:00 AM EST Reads: 1,133 |
By Elizabeth White ![]() Dec. 18, 2017 03:45 PM EST Reads: 2,435 |
By Elizabeth White ![]() Dec. 18, 2017 01:30 PM EST Reads: 2,447 |
By Elizabeth White ![]() Dec. 18, 2017 01:00 PM EST Reads: 4,255 |
By Liz McMillan ![]() Dec. 17, 2017 04:00 PM EST Reads: 1,442 |
By Pat Romanski ![]() Dec. 17, 2017 02:00 PM EST Reads: 1,532 |
By Elizabeth White ![]() Dec. 17, 2017 10:00 AM EST Reads: 1,589 |
By Liz McMillan ![]() Dec. 15, 2017 11:00 AM EST Reads: 2,493 |
By Elizabeth White ![]() Dec. 14, 2017 04:00 PM EST Reads: 1,609 |
By Liz McMillan ![]() Dec. 14, 2017 11:45 AM EST Reads: 1,662 |
By Elizabeth White ![]() Dec. 14, 2017 11:00 AM EST Reads: 1,663 |
By Pat Romanski ![]() Dec. 13, 2017 02:00 PM EST Reads: 1,417 |