Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
Functions, 89 of 121
For information on syntax and semantics, see "Analytic Functions".
STDDEV_POP
computes the population standard deviation and returns the square root of the population variance. You can use it as both an aggregate and analytic function.
The expr is a number expression, and the function returns a value of type NUMBER
. This function is same as the square root of the VAR_POP
function. When VAR_POP
returns null, this function returns null.
The following example returns the population and sample standard deviations of profit from sales in the SALES
table.
SELECT STDDEV_POP(s_profit), STDDEV_SAMP(s_profit) FROM sales; STDDEV_POP STDDEV_SAM ---------- ---------- 173.975774 177.885831
The following example returns the population standard deviations of salaries in the EMP
table by department:
SELECT deptno, ename, sal, STDDEV_POP(sal) OVER (PARTITION BY deptno) AS pop_std FROM emp; DEPTNO ENAME SAL POP_STD ---------- ---------- ---------- ---------- 10 CLARK 2450 1546.14215 10 KING 5000 1546.14215 10 MILLER 1300 1546.14215 20 SMITH 800 1004.73877 20 ADAMS 1100 1004.73877 20 FORD 3000 1004.73877 20 SCOTT 3000 1004.73877 20 JONES 2975 1004.73877 30 ALLEN 1600 610.100174 30 BLAKE 2850 610.100174 30 MARTIN 1250 610.100174 30 JAMES 950 610.100174 30 TURNER 1500 610.100174 30 WARD 1250 610.100174
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|