Analyze Your Data Using Window Functions
Window functions have been part of SQL Server since the 2005 release, and while they don’t let you do anything that you can’t do with traditional queries, it makes those complicated queries much easier to write and read and usually executes them faster than traditional queries.
There are three different categories of window functions: ranking, value, and aggregate.
In this chapter, we will look at the different functions within each category and see what type of business problems each can be used to solve. We will examine example queries to understand what each function does and how to construct the function within the query. We will also learn the different keywords required to call the function and develop some complex outputs.
The main topics we will cover in this chapter are as follows:
- Understanding window functions
- Using window functions
- Example scenarios and business problems