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.

Pesquisar
Categorias
Leia mais
Outro
North America Aircraft Hangar Market   Size, Share, Demand, Rising Trends, Growth and Competitors Analysis
"Executive Summary North America Aircraft Hangar Market :  Data Bridge Market...
Por Nidshaaa Shaaaaa 2025-06-25 09:01:31 0
Outro
GCC Food Safety Testing Market Trends, Key Drivers, Growth and Opportunity Analysis
GCC Food Safety Testing Market Segmentation, By Testing Type (Allergen Testing, Pathogens...
Por Shreya Patil 2025-07-01 08:00:23 0
Outro
Newborn Screening Market Research, Review, Applications and Forecast to 2025
The most recent report published by Vantage Market Research indicates that the "Newborn Screening...
Por Tushar Jane 2025-05-26 05:16:15 0
Início
Why Architects Recommend Elegant Decking for High-End Projects?
In luxury architecture, the little things count: it's what takes a space from the ordinary to the...
Por FaisalAmal Faisal 2025-05-17 13:22:31 0
Networking
Belper Taxi Firms Trusted Local Transport in the Heart of Derbyshire
Located in the picturesque Amber Valley district of Derbyshire, Belper is a thriving market town...
Por Fenik Eniks 2025-05-29 07:38:31 0
Omaada - A global social and professionals networking platform https://www.omaada.com