Labels

Saturday, April 23, 2022

Aggregate Functions in SQL (Part -7)

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

We often use aggregate functions with the GROUP BY, WHERE and HAVING clauses of the SELECT statement.


1)     SUM:

Sum function is used to calculate the sum of all selected columns. It works on numeric fields only.


2)  COUNT:

COUNT function is used to Count the number of rows in a database table. It can work on both numeric and non-numeric data types.


3) MAX:

MAX function is used to find the maximum value of a certain column. This function determines the largest value of all selected values of a column.


4) MIN:

MIN function is used to find the minimum value of a certain column. This function determines the smallest value of all selected values of a column.


5)     AVG:

 The AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all non-Null values.


No comments:

Post a Comment