Day 4. Working with Row Aggregates and Grouping

Now that you have learned to combine and manipulate columns to change data, you are ready for the next major step in the data retrieval process. Today you will learn how to use the aggregate functions to display a set of information that describes a group of rows. The topics we will discuss are

  • Using the aggregate functions: SUM(), AVG(), MIN(), MAX(), COUNT(), and COUNT_BIG

  • Understanding how nulls affect aggregate functions

  • Finding subtotals (and subaverages and so forth) with GROUP BY

  • Using HAVING to select from aggregate result sets

  • Displaying summary values with ROLLUP and CUBE

  • Using CASE to build a pivot table

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.