Aggregatefunctions
AGGREGATE FUNCTIONS :¶
An aggregate function performs a calculation on a set of values, and returns a single value. aggregate functions ignore null values. Aggregate functions are often used with the GROUP BY clause of the SELECT statement
MAX() :¶
It returns maximum value in the expression.
1 | |
ex:
1 | |
MIN() :¶
It returns Minimum value in the expression
1 | |
ex:
1 | |
SUM():¶
Returns the sum of all the values, in the expression. SUM can be used with numeric columns only.
1 | |
ex:
1 | |
AVG():¶
This function returns the average of the values in a group
1 | |
ex:
1 | |
COUNT():¶
This function returns the number of items found in a group. COUNT operates like the COUNT_BIG function. These functions differ only in the data types of their return values. COUNT always returns an int data type value. COUNT_BIG always returns a bigint data type value.
1 | |
ex:
1 2 3 | |
count(*) ---consider the null values as count count(columnname)----does not consider the null values as count