O'Reilly logo

SQL: Visual QuickStart Guide by Chris Fehily

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6. Summarizing and Grouping Data

The preceding chapter described scalar functions, which operate on individual row values. This chapter introduces SQL’s aggregate functions, or set functions, which operate on a group of values to produce a single, summarizing value. You apply an aggregate to a set of rows, which may be:

  • All the rows in a table

  • Only those rows specified by a WHERE clause

  • Those rows created by a GROUP BY clause

No matter how many rows the set contains, an aggregate function returns a single statistic: a sum, minimum, or average, for example.

In this chapter, I’ll also cover the SELECT statement’s GROUP BY clause, which groups rows, and HAVING clause, which filters groups.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required