Oracle® Database SQL Reference 10g Release 2 (10.2) Part Number B14200-02 |
|
|
PDF · Mobi · ePub |
See Also:
"Analytic Functions" for information on syntax, semantics, and restrictionsVAR_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.
This function takes as an argument any numeric datatype or any nonnumeric datatype that can be implicitly converted to a numeric datatype. The function returns the same datatype as the numeric datatype of the argument.
See Also:
Table 2-10, "Implicit Type Conversion Matrix" for more information on implicit conversionIf the function is applied to an empty set, then 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 sample employees
table.
SELECT VAR_SAMP(salary) FROM employees; VAR_SAMP(SALARY) ---------------- 15283140.5
Please refer to the analytic example for VAR_POP.