SQL provides many built-in functions to perform operations on data. These functions are useful for performing mathematical calculations, string concatenations, sub-strings, etc. SQL functions are divided into two categories:
1.Aggregate Functions
2.Scalar Functions
Both aggregate functions and scalar functions return a single value. Aggregate functions operate on many records, while scalar functions operate on each record independently.
Aggregate functions perform calculations on a set of values and return a single value. These functions are often used with the GROUP BY clause of the SELECT statement to group multiple rows together as input to form a single value output. Aggregate functions ignore NULL values, except for COUNT(*).
List of Aggregate Functions:
1.COUNT(): Returns the number of rows that match the specified criterion.
2.SUM(): Returns the total sum of a selected numeric column.
3.AVG(): Returns the average value of a selected numeric column.
4.MAX(): Returns the maximum value of a selected column.
5.MIN(): Returns the minimum value of a selected column.
The COUNT() function returns the number of rows that match the specified criterion.
The SUM() function returns the total sum of a selected numeric column.
The AVG() function returns the average value of a selected numeric column.
The MAX() function returns the maximum value of a selected column.
The MIN() function returns the minimum value of a selected column.