O'Reilly logo

Absolute Beginner’s Guide to Databases by John V. Petersen

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

Use Aggregate Functions

You will rarely use the Group By clause without also employing one of the SQL aggregate functions. The five SQL aggregate functions are Count(), Sum(), Avg(), Min(), and Max(). Their names give a good indication of what they do. For example, Count() tallies the number of records, Sum() calculates the total of a mathematical expression of fields, and Avg() calculates the average of a mathematical expression of fields. Details on how each of these aggregate functions works are presented in the following three sections.

The Count() Function

The Count() function counts the number of records for each group. In this case, there are two groups, one each for business and individual clients. The question you are attempting ...

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