stddev_samp

Computes the sample standard deviation over each aggregate.

Syntax

stddev_samp([DISTINCT] arith_expr)

Arguments

arith_expr The arithmetic expression on which the sample standard deviation is to be computed.

Description

This function computes the sample standard deviation for each aggregate from the value of arith_expr for each row in the aggregate. The value is computed as the square root of the sample variance (var_samp).

If distinct is specified, duplicate values are not included in the computation.

Example

open nsfawards;

select orgid, count(*), sqrt(var_samp(amount)), stddev_samp(amount) from nsforg natural join award
     group by 1 having count(*) >= 5000;

orgid    count(*) sqrt(var_samp(amount)) stddev_samp(amount)
CHE          5702       576960.698421488    576960.698421488
DMI          6526       262169.630640541    262169.630640541
DMR          5381        2423329.4623576     2423329.4623576
DMS          9910       502917.633291064    502917.633291064
DUE          8810       409930.594753537    409930.594753537
EAR          7256       1622841.19634197    1622841.19634197
IBN          5438        256993.53678763     256993.53678763
INT          5954       601549.169379129    601549.169379129
OCE          5998       3979993.54565697    3979993.54565697
SES          5944       360770.245258083    360770.245258083