What Are Aggregate Functions?

Functions are keywords in SQL used to manipulate values within columns for output purposes. A function is a command always used in conjunction with a column name or expression. There are several types of functions in SQL. This hour covers aggregate functions. An aggregate function is used to provide summarization information for an SQL statement, such as counts, totals, and averages.

The aggregate functions discussed in this hour are

  • COUNT

  • SUM

  • MAX

  • MIN

  • AVG

The following queries show the data used for most of this hour's examples:

						SELECT *
						FROM PRODUCTS_TBL;
 PROD_ID PROD_DESC COST ---------- ------------------------------ ------ 11235 WITCHES COSTUME 29.99 222 PLASTIC PUMPKIN 18 INCH 7.75 13 FALSE PARAFFIN TEETH 1.1 ...

Get Sams Teach Yourself SQL in 24 Hours, 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.