Using Aggregate Functions : Introduction « Aggregate Functions « Oracle PL/SQL Tutorial






Aggregate functions operate on a group of rows at the same time.

Aggregate functions return one row of output for each group of rows.

For example, computing the average salary of employees and finding the maximum salary of employees.

Aggregate functions are also called group functions because they operate on groups of rows.

The aggregate functions are mainly numerical.

FunctionDescription
AVG(x)Returns the average value of x.
COUNT(x)Returns the number of rows returned by a query involving x.
GLCGreatest lower bound of an MLSLABEL.
LUBLeast upper bound of an MLSLABEL.
MAX(x)Returns the maximum value of x.
MEDIAN(x)Returns the median value of x.
MIN(x)Returns the minimum value of x.
STDDEV(x)Returns the standard deviation of x.
SUM(x)Returns the sum of x.
VARIANCE(x)Returns the variance of x.


Here are some points to remember when using aggregate functions

  1. COUNT(), MAX(), and MIN() functions operate numbers, strings, and datetimes.
  2. Null values are ignored by aggregate functions.
  3. DISTINCT keyword with an aggregate function excludes duplicate entries from the aggregate function's calculation.
12.1.Introduction
12.1.1.Using Aggregate Functions
12.1.2.Use the aggregate functions with valid expression
12.1.3.Use the DISTINCT keyword to exclude identical values from a group computation
12.1.4.List employee whose salary is higher than the average salary