| Oracle8i SQL Reference Release 2 (8.1.6) A76989-01 |
|
Functions, 117 of 121
For information on syntax and semantics, see "Analytic Functions".
VAR_SAMP returns the sample variance of a set of numbers after discarding the nulls in this set. 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. If the function is applied to an empty set, it returns null. The function makes the following calculation:
(SUM(expr2) - SUM(expr)2 / COUNT(expr)) / (COUNT(expr) - 1)
This function is similar to VARIANCE, except that given an input set of one element, VARIANCE returns 0 and VAR_SAMP returns null.
The following example returns the sample variance of the salaries in the EMP table.
SELECT VAR_SAMP(sal) FROM emp; VAR_SAMP(SAL) ------------- 1398313.87
See the example at "VAR_POP".
|
|
![]() Copyright © 1999 Oracle Corporation. All Rights Reserved. |
|