Chapter 23

Basic Aggregate Functions

Abstract

An aggregate function reduces a set of values to a single value. Some of the basic ones are built into SQL, and they are usually fast because optimizers and index structures often store this data for their own use.

Keywords

SUM()

AVG()

MAX()

MIN()

COUNT()

COUNT(*)

Cardinality

ALL

DISTINCT

An aggregate function reduces a set of values to a single value. Some of the basic ones are built into SQL, and they are usually fast because optimizers and index structures often store this data for their own use. The original functions are SUM(), AVG(), MAX(), MIN(), COUNT(), and COUNT(*).

Simple aggregate functions first construct a set of values as defined by the parameter. The parameter is usually a single ...

Get Joe Celko's SQL for Smarties, 5th 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.