SQL - Aggregate Functions


In general, aggregation is a consideration of a collection of objects that are bound together as a single entity. SQL provides a set of aggregate functions that perform operations on all the entities of the column of a table considering them as a single unit. Following are the SQL aggregate functions −

Sr.No. Function & Description
1 APPROX_COUNT_DISTINCT()

Returns the approximate number of rows with distinct expression values.

2 AVG()

Returns the average of the fields in a particular column that has only numeric values.

3 CHECKSUM_AGG()

Returns the checksum value.

4 COUNT_BIG()

Returns the count of the number of items or rows selected by the select statement.

5 COUNT()

Returns the number of non-NULL values in a particular column.

6 GROUPING()

Returns whether the specified column expression in a group by list is aggregate or not.

7 GROUPING_ID()

Returns the level of grouping.

8 MAX()

Returns the maximum value among the fields in a particular column.

9 MIN()

Returns the minimum value among the fields in a particular column.

10 STDEV()

Returns the statistical standard deviation of the fields (numerical values) in a particular column.

11 STDEVP()

Returns the population standard deviation for the fields (numerical values) in a particular column.

12 SUM()

Returns the sum of all the fields (numeric) in a particular column.

13 VAR()

Returns the statistical standard variance of the fields (numerical values) in a particular column.

14 VARP()

Returns the population standard variance of the fields (numerical values) in a particular column.

Advertisements