Types of set functions and how to specify them
The following types of set function exist:
COUNT (*) function:
Obtains the table row count including rows that contain null values
AVG function:
Obtains average column value
MAX function:
Obtains maximum column value
MIN function:
Obtains minimum column value
SUM function:
Obtains total column values
COUNT function:
Obtains the table row count excluding rows that contain null values
Except for the COUNT (*) function, set functions can be specified in two ways. Note that both methods of specifying
the MAX or MIN function produce the same result.
ALL:
The set function is only applied to rows from the specified columns that do not contain null values.
DISTINCT:
The set function is applied to rows from the specified column that do not contain null or duplicate values.
Functions in which ALL is specified are called ALL set functions. Functions in which DISTINCT is specified are called
DISTINCT set functions. The default set function is ALL.
Figure: Rows processed by ALL and DISTINCT set functions shows an example of the rows processed by the ALL
and DISTINCT set functions.
[Figure: Rows processed by ALL and DISTINCT set functions]
The methods of specifying set functions are listed in Table: Methods of specifying set functions.
18