Hi All,
Can anyone give me the details in regarding of Aggregate function and their usees in Business applications.
Thanks
AShok
Printable View
Hi All,
Can anyone give me the details in regarding of Aggregate function and their usees in Business applications.
Thanks
AShok
refer this [URL="http://www.java2s.com/Code/Oracle/Aggregate-Functions/CatalogAggregate-Functions.htm"]link[/URL]
aggregate function nothing but group fuction.
there are max, min, avg,sum, count, stddev, variance
[B]>>aggregate function nothing but group fuction.[/B]
No. Both are different.
Group functions return one result per one group.
SQL> SELECT JOB, AVG(SAL) FROM EMP
2 GROUP BY JOB;
JOB AVG(SAL)
--------- ---------
ANALYST 300
CLERK 103.75
MANAGER 275.83333
PRESIDENT 500
SALESMAN 140
Using aggregate functions we can display groups results along with individual rows which is not possible using group functions.
SQL> SELECT ENAME,JOB, AVG(SAL)
2 OVER (PARTITION BY JOB) AVGSAL
3 FROM EMP;
ENAME JOB AVGSAL
---------- --------- ---------
SCOTT ANALYST 300
FORD ANALYST 300
SMITH CLERK 103.75
ADAMS CLERK 103.75
MILLER CLERK 103.75
JAMES CLERK 103.75
JONES MANAGER 275.83333
CLARK MANAGER 275.83333
BLAKE MANAGER 275.83333
KING PRESIDENT 500
ALLEN SALESMAN 140
MARTIN SALESMAN 140
TURNER SALESMAN 140
WARD SALESMAN 140
14 rows selected.