0% found this document useful (0 votes)
7 views3 pages

5.SQL Aggregate Functions

SQL aggregate functions perform calculations on multiple rows of a single column, returning a single summarized value. Key functions include Count(), Sum(), Avg(), Min(), and Max(), each providing different statistical insights about the data. For example, Count() can determine the total number of records or distinct values, while Sum() calculates the total of non-null values.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

5.SQL Aggregate Functions

SQL aggregate functions perform calculations on multiple rows of a single column, returning a single summarized value. Key functions include Count(), Sum(), Avg(), Min(), and Max(), each providing different statistical insights about the data. For example, Count() can determine the total number of records or distinct values, while Sum() calculates the total of non-null values.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SQL Aggregate Functions

o SQL aggregation function is used to perform the calculations on multiple rows of a single
column of a table. It returns a single value.
o It is also used to summarize the data.

Types of SQL Aggregation Function

Count():

Count(*): Returns total number of records .i.e 6.


Count(salary): Return number of Non Null values over the column salary. i.e 5.
Count(Distinct Salary): Return number of distinct Non Null values over the
column salary .i.e 4
Sum():

Sum all Non Null values of Column salary i.e., 310


sum Sum of all distinct Non-Null values i.e., 250.

Avg():

Avg(salary) = Sum(salary) / count(salary) = 310/5


Avg(Distinct salary) = sum(Distinct salary) / Count(Distinct Salary) = 250/4
Min():

Minimum value in the salary column except NULL i.e., 40.

MAX()
Maximum value in the salary i.e., 80.

You might also like