Group Function
Group functions are those statistical functions, which gives information about a group of value taken as whole.
- COUNT
- SUM
- MAX(column name)
- MIN(column name)
- AVG([DISTINCT | ALL] column name)
COUNT
Count function determines the number of rows or NON NULL columns value. If * is
passed, the total number of rows is returned.
Example
- Select COUNT(*) from Employee;
- Select count (DISTINCT Emp_ Job) from employee;
SUM
This function returns the sum of values for the select list columns.
Example
- Select SUM(salary) From employee;
MAX
This function return the maximum value of the selected list of item.
Example
- Select MAX(salary) from employee
- Where Emp_job = ‘salesman’;
MIN
This function returns the minimum value of the selected list of items.
Example
- Select MIN(SALARY) from Employee;
AVG([DISTINCT | ALL] column name)
This function returns the average salary and number of column value.
Example
- Select AVG(salary) , COUNT(*) from employee
- where dept_no = 102;
Summary
Thus, we learnt, group functions are those statistical functions, which gives information about a group of value. There are some types of group function such as Count, Sum, Max, Min, Avg. We learnt, how to use these group functions in Oracle with the examples.