AGGREGATE FUNCTIONS DBMS
In DBMS, aggregate functions are used to combine multiple values of rows to get a single meaningful value.
Various Aggregate functions are:Count():
- Count(*): Returns the total number of records
- Count(column_name): Returns the total number of non-null values in the column.
- Count(distinct column_name): Returns the total number of distinct non-null values in the column.
Sum():
- Sum(column_name): Sum of all non-null values in the column
- Sum(distinct column_name): Sum of all distinct non-null values in the column
Avg():
- Avg(salary) = Sum(salary) / count(salary) = 310/5
- Avg(Distinct salary) = sum(Distinct salary) / Count(Distinct Salary) = 250/4
Min():
- Min(salary): Minimum value in the salary column except
NULL i.e., 40. - Max(salary): Maximum value in the salary i.e., 80.
Comments
Post a Comment