0% found this document useful (0 votes)
2 views

5.SQL Aggregate Functions

SQL aggregate functions perform calculations on multiple rows of a single column, returning a single value to summarize data. Key functions include Count, Sum, Avg, Min, and Max, which provide insights such as total records, sum of values, average, minimum, and maximum values respectively. Each function has variations to handle distinct and non-null values.

Uploaded by

sharmasudip010
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

5.SQL Aggregate Functions

SQL aggregate functions perform calculations on multiple rows of a single column, returning a single value to summarize data. Key functions include Count, Sum, Avg, Min, and Max, which provide insights such as total records, sum of values, average, minimum, and maximum values respectively. Each function has variations to handle distinct and non-null values.

Uploaded by

sharmasudip010
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

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