Returns the variance of a set of numbers.
Parameter |
Description |
|---|---|
expression |
Any numeric data type (FLOAT, REAL, or DOUBLE) expression. The expression (commonly a column name) whose sample-based variance is calculated over a set of rows. |
DOUBLE
The formula used to calculate VARIANCE is
VARIANCE returns a result of data type double-precision floating-point. If applied to the empty set, the result is NULL, which returns NULL for a one-element input set.
VARIANCE does not support the keyword DISTINCT. A syntax error is returned if DISTINCT is used with VARIANCE.
SQL—Vendor extension to ISO/ANSI SQL grammar.
Sybase—Not supported by Adaptive Server Enterprise.
SELECT Salary FROM Employees WHERE DepartmentID = 300
|
salary |
|---|
|
51432.000 |
|
57090.000 |
|
42300.000 |
|
43700.00 |
|
36500.000 |
|
138948.000 |
|
31200.000 |
|
58930.00 |
|
75400.00 |
The following statement returns the value 1063923790.99999994:
SELECT VARIANCE ( Salary ) FROM Employees WHERE DepartmentID = 300
SELECT UnitPrice FROM Products WHERE name = 'Tee Shirt'
|
UnitPrice |
|---|
|
9.00 |
|
14.00 |
|
14.00 |
The following statement returns the value 8.33333333333334327:
SELECT VARIANCE ( UnitPrice ) FROM Products WHERE name = 'Tee Shirt'