Unit Iv
Unit Iv
FUNCTIONS
UNIT-IV
GROUP FUNCTIONS
• These functions work on multiple records of a single column
and returns a single value.
• Example min(),max(),avg(),sum(),count().
To find sum of salary for all employees.
Ans:-select sum(sal) from emp;
COUNT() FUNCTION
• This function ignores null values of any column.
• While count(*) counts total number of record for that column
including null values.
Example:-
Select count(comm)from emp;
See the result.
Select Count(*)from emp;
See the result.
You will find the difference.
MIN(),MAX()& AVG() FUNCTION
• Example for these functions
employee manager
---------- ----------
SMITH FORD
ALLEN BLAKE
WARD BLAKE
JONES KING
MARTIN BLAKE
BLAKE KING
CLARK KING
SCOTT JONES
TURNER BLAKE
ADAMS SCOTT
JAMES BLAKE
FORD JONES
MILLER CLARK
OUTER JOIN
• It is used to fetch those record which
don’t satisfy the equi join condition.
• This can be performed by outer join
operator(+).
• Select ename, job,dname,loc from
emp,dept where
emp.deptno(+)=dept.deptno;