SQL aggregation function is used to perform the calculations on multiple rows of a single column of a table. It returns a single value.
Types of SQL Aggregation Function
COUNT FUNCTION :- 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.
SELECT COUNT(*)
FROM TABLE_NAME;
SUM FUNCTION :- Sum function is used to calculate the sum of all selected columns. It works on numeric fields only.
SELECT SUM(COLUMN)
FROM TABLE_NAME;
AVG FUNCTION :- The AVG function is used to calculate the average value of the numeric type. AVG function returns the average of all non-Null values.
SELECT AVG(COLUMN)
FROM TABLE_NAME;
MAX FUNCTION :-
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.
SELECT MAX(COLUMN)
FROM TABLE_NAME;
MIN FUNCTION :- 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.
SELECT MIN(COLUMN)
FROM TABLE_NAME;
Top comments (0)