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 ...

Get Absolute Beginner’s Guide to Databases now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.