SQL Aggregate Functions

This function return a single value calculated from values in a column

MIN ()

This function returns the smallest value in a given column

Example:

SELECT MIN(SALARY) FROM EMPLOYEE;

 

MAX ()

This function returns the largest value in a given column

Example:

SELECT MAX(SALARY) FROM EMPLOYEE;

 

SUM ()

This function returns the sum of the numeric values in a given column

Example:

SELECT SUM(SALARY) FROM EMPLOYEE;

 

AVG ()

This function returns the average of the numeric values in a given column

Example:

SELECT AVG(SALARY) FROM EMPLOYEE;

 

COUNT ()

This function returns total number of values in a given column

Example:

SELECT COUNT(SALARY) FROM EMPLOYEE;

 

COUNT (*)

This function returns total number of rows in a given column

Example:

SELECT COUNT(*) FROM EMPLOYEE;

 

FIRST()

This function returns the first value

 

LAST()

This function returns the last value