Aggregate Functions

You use aggregate functions to summarize table data. The aggregate functions available include COUNT, COUNT_BIG, SUM, AVG, MIN, and MAX. The following sections discuss each of these aggregate functions. You can find additional aggregate functions in Books On-line (online help for SQL Server).

COUNT

You use the COUNT function to count the number of rows in a table. It looks like this:

SELECT COUNT(*) AS CountOfCustomers FROM Customers
						

The example counts the number of rows in the Customers table (see Figure 6.10).

Figure 6.10. A SELECT statement that counts the number of rows in the Customers table.

Get Alison Balter's Mastering Access 2002 Enterprise Development 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.