Computes the statistical variance of a sample consisting of a numeric-expression, as a double, and returns the variance of a set of numbers. var and variance are aliases of var_samp, and use the same syntax.
var_samp ( [ all | distinct] expression )
applies var_samp to all values. all is the default.
eliminates duplicate values before var_samp is applied.
is any numeric datatype (float, real, or double) expression.
The following statement lists the average and variance of the advances for each type of book in the pubs2 database:
select type, avg(advance) as "avg", var_samp(advance) as "variance" from titles where total_sales > 2000 group by type order by type
var_samp returns a result of double-precision floating-point datatype. If applied to the empty set, the result is NULL.
Figure 2-7: The formula for sample-related statistical aggregate functions
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute var_samp.
For general information about aggregate functions, see “Aggregate functions” in Adaptive Server Enterprise Reference Manual: Building Blocks.
Functions stddev_pop, stddev_samp, var_pop