-
Junior Member
Aggregate function
Hi All,
Can anyone give me the details in regarding of Aggregate function and their usees in Business applications.
Thanks
AShok
-
Expert Member
-
Junior Member
Re: Aggregate function
aggregate function nothing but group fuction.
there are max, min, avg,sum, count, stddev, variance
-
Expert Member
Re: Aggregate function
>>aggregate function nothing but group fuction.
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules