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.

Rechercher
Catégories
Lire la suite
Autre
Windshield Repair near me Dallas
Fast & Reliable Windshield Repair & Replacement near You in Dallas & Texas –...
Par Technology Welldone 2025-06-22 07:23:07 0
Autre
グローバルサーボケーブル市場の産業全体規模とシェア分析2025-2031
QYResearch株式会社(所在地:東京都中央区)は、最新の調査資料「サーボケーブル―グローバル市場シェアとランキング、全体の売上と需要予測、2025~2031」を2025年7月8日より発行し...
Par Liu Yuan 2025-07-08 02:23:42 0
Jeux
The Complete 34-Step Guide to ODIN Valhalla Rising's Forging
Forging in ODIN Valhalla Rising is one of the most intricate and rewarding systems in the game....
Par Dczc Dxzc 2025-07-02 06:58:26 0
Information Technology
eCommerce App Development Company
Looking for a trusted ecommerce app development company? Emizentech is a ecommerce application...
Par Steve Jonas 2025-05-15 06:02:18 0
Art
Rising Demand for Preservative-Free Packaging Drives MEA Airless Dispenser Market
"Executive Summary Middle East and Africa Airless Dispenser Market :   Data...
Par Komal Galande 2025-07-01 04:21:29 0
Omaada - A global social and professionals networking platform https://www.omaada.com