Microsoft SQL Server 2012 Bible
by Adam Jorgensen, Jorge Segarra, Patrick LeBlanc, Jose Chinchilla, Aaron Nelson
Chapter 10
Aggregating, Windowing, and Ranking Data
In This Chapter
Understanding Basic Aggregations
Using SQL Server Aggregation Functions
Customizing Aggregation Sets
Understanding Windowing
Ranking Functions
Information is the foundation of most organizational decisions. In its raw form, that data is meaningless and offers little value to an information wonk or data analyst; not until the data is summarized or grouped is it considered useful information. Although summarization and analysis can certainly be performed with other tools, such as Reporting Services, Analysis Services, PowerPivot, or an external tool such as SAS, SQL is a set-based language, and a fair amount of summarizing and grouping can be performed well within the SQL SELECT statement.
SQL excels at calculating sums, max values, and averages for the entire data set or for segments of data. In addition, the product of SQL queries can be as simple as a table to a complex pivot table that includes subtotals and totals. In this chapter you explore different ways to group, gather, and summarize data within SQL Server.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access