Aggregate functions are applied to agroup of data values from a column. Aggregate functions always return a singlevalue.
How database supports following aggregate functions:
AVG: Calculates the arithmetic mean (average) of the data valuescontained within a column. The column must contain numeric values.
Syntax:
SELECTAVG(column_name) FROM table_name
MAX and MIN: Calculate the maximum and minimum data value of the column,respectively. The column can contain numeric, string, and date/time values.
Syntax:
SELECT MAX(column_name) FROM table_name
SELECT MIN(column_name) FROM table_name SUM: Calculates the total of all data values in a column. The columnmust contain numeric values.
Syntax:
SELECT SUM(column_name) FROM table_name
COUNT: Calculates the number of (non-null) data values in a column. Theonly aggregate function not being applied to columns is COUNT(*). This functionreturns the number of rows (whether or not particular columns have NULLvalues).
Syntax:
SELECT COUNT(column_name) FROM table_name
COUNT_BIG: New and Analogous to COUNT, the only difference being thatCOUNT_BIG returns a value of the BIGINT data type.
Syntax:
COUNT_BIG ( { [ ALL | DISTINCT ] expression } | * )
Aggregatefunction Example:
SELECT COUNT(*)FROM tblcheck
Output:
CountData
9
· SELECT SUM(empid) AS SumData FROM tblcheck
Anonymous User
13-Mar-2019Thank You for sharing.
Sunil Singh
16-Jun-2017Your words increase my knowledge for sure. Thanks