Computes the standard deviation of a sample consisting of a numeric expression, as a double. stdev and stddev are aliases for stddev_samp, and use the same syntax.
stddev_samp ( [ all | distinct ] expression )
applies stddev_samp to all values. all is the default.
eliminates duplicate values before stddev_samp is applied.
is any numeric datatype (float, real, or double precision) expression.
The following statement lists the average and standard deviation of the advances for each type of book in the pubs2 database.
select type, avg(advance) as "avg", stddev_samp(advance) as "stddev" from titles where total_sales > 2000 group by type order by type
Computes the sample standard deviation of the provided value expression evaluated for each row of the group (if distinct was specified, then each row that remains after duplicates have been eliminated), defined as the square root of the sample variance.
Figure 2-5: The formula for sample-related statistical aggregate functions
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute stddev_samp.
For general information about aggregate functions, see “Aggregate functions” in Adaptive Server Enterprise Reference Manual: Building Blocks.
Functions stddev_pop, var_pop, var_samp