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
1APPROX_COUNT_DISTINCT()

Returns the approximate number of rows with distinct expression values.

2AVG()

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

3CHECKSUM_AGG()

Returns the checksum value.

4COUNT_BIG()

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

5COUNT()

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

6GROUPING()

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

7GROUPING_ID()

Returns the level of grouping.

8MAX()

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

9MIN()

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

10STDEV()

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

11STDEVP()

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

12SUM()

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

13VAR()

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

14VARP()

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

Advertisements
close