SQL Function
 
Aggregate functions
 
Aggregate functions operate against a collection of values, but return a single value.
 
Note: If used among many other expressions in the item list of a SELECT statement, the SELECT must have a GROUP BY clause!!
 
Following are SQL Aggregate Functions with their description:
 
 
Syntax:
SELECT function_name(column_name) FROM table_name
 
Example for the Employee table below:
 
 
We key in the query
SELECT Avg(Salary) FROM Employee
 
will yield the result set that shows the average salary of the employees:
 
Similarly we can use the sum function to Add all the numeric values in the selected table by typing in the following query:
 
Lets take an example using Max function to find out the maximum value from the field-Age. We type the following query:
SELECT Max(Age) FROM Employee;
 
which results in:
 
Similarly we can use MIn function to find the minimum value from a column
 
We key in another query which is slightly different from others because he function that we use here i.e, count(*), is not supplied with any column, as shown below:
SELECT Count(*) FROM Employee
 
The above statement returns total number of rows in the Employee table i.e