Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
Functions, 118 of 121
For information on syntax and semantics, see "Analytic Functions".
VARIANCE
returns variance of expr. You can use it as an aggregate or analytic function.
Oracle calculates the variance of expr as follows:
The following example calculates the variance of all salaries in the EMP
table:
SELECT VARIANCE(sal) "Variance" FROM emp; Variance ---------- 1389313.87
The query returns the cumulative variance of salary values in Department 30 ordered by hiredate.
SELECT ename, sal, VARIANCE(sal) OVER (ORDER BY hiredate) FROM emp WHERE deptno=30; ENAME SAL VARIANCE(S ---------- ---------- ---------- ALLEN 1600 0 WARD 1250 61250 BLAKE 2850 707500 TURNER 1500 511666.667 MARTIN 1250 444250 JAMES 950 446666.667
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|