Aggregate Function

Aggregate function produce a single value for the entire group of table entries. An aggregate or column function also be used with the SELECT command.

SUM :- SUM function calculates the arithmetic sum of all selected values of a given columns. For example, to find the SUM of BASIC salary from the EMPLOYEE table.

SELECT SUM (BASIC) FROM EMPLOYEE;

AVG :- AVG function calculates the average of all selected values of a given field. For example, to find the average of BASIC salary from the EMPLOYEE table.

SELECT AVG (BASIC) FROM EMPLOYEE;

MAX/MIN :- MAX function calculates the largest of all selected value of a given collection. For example, display the maximum salary the BASIC column.

SELECT MAX/MIN (BASIC) FROM EMPLOYEE;

COUNT :- COUNT function count the number of row in the output table. The COUNT function with the (*) asterisk counts the number of row in the resulting table. For example, to find the how many EMPLOYEE are in the EMPLOYEE table.

SELECT COUNT(*) FROM EMPLOYEE;