Analytical functions

What are analytical functions and how are they used?

Questions by Hsingh85

Showing Answers 1 - 1 of 1 Answers

Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause.

for example:

SQL> select deptno,
  2  ename,
  3  sal,
  4  sum(sal) over (partition by deptno
  5  order by sal,ename) CumDeptTot,
  6  sum(sal) over (partition by deptno) SalByDept,
  7  sum(sal) over (order by deptno, sal) CumTot,
  8  sum(sal) over () TotSal
  9  from emp
10  order by deptno, sal;

over by clause, order by clause,partition ny clause comes under anyalytical clause.....
check below.

select ... analytic-function (...) over (partition by ...) .. select ... analytic-function (...) over (order by ...) .. select ... analytic-function (...) over (partition by ... order by ...) .. 

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions