What are Aggregate functions in SQL

0
47

In database management an aggregate function is a function where the values of multiple rows are grouped together as input on certain criteria to form a single value of more significant meaning.

Various Aggregate Functions are as follows:

1) Count()

2) Sum()

3) Avg()

4) Min()

5) Max()

 

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(salary):  Sum all Non Null values of Column salary i.e., 310
sum(Distinct salary): Sum of all distinct Non-Null values i.e., 25

 

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.

Suche
Kategorien
Mehr lesen
Andere
From Planning to Execution: How Low Voltage Contractors Handle It All
Low voltage systems are integral to building functionality. From efficient lighting systems to...
Von Smith Arthur 2025-06-20 07:32:15 0
Networking
Metaverse in Healthcare Market Investment Trends, Value Proposition, Industry Expansion, Planning and Analytics
"Executive Summary Metaverse in Healthcare Market :  Data Bridge Market Research...
Von Shim Carter 2025-06-17 07:12:16 0
Andere
Above Ground Pools Market Sees Soaring Demand in Residential Leisure and Wellness
"Executive Summary Above Ground Pools Market : Data Bridge Market Research analyses...
Von Rahul Rangwa 2025-06-19 06:48:17 0
Andere
Gurgaon to Shimla Cab
Book Gurgaon to Shimla cab online at best price. CabBazar provides car rental services for all...
Von Cab Bazar 2025-06-13 07:11:19 0
Omaada - A global social and professionals networking platform https://www.omaada.com