Contents Index STDDEV function [Aggregate] STDEV_SAMP function [Aggregate]

ASA SQL Reference
  SQL Functions
    Alphabetical list of functions

STDDEV_POP function [Aggregate]


Function 

Computes the standard deviation of a population consisting of a numeric-expression, as a DOUBLE.

Syntax 

STDDEV_POP ( numeric-expression )

Parameters 

numeric-expression    The expression whose population-based standard deviation is calculated over a set of rows. The expression is commonly a column name.

Usage 

The population-based standard deviation (s) is computed according to the following formula:

s = [ (1/N) * SUM( xi - mean( x ) )2 ]1/2

This standard deviation does not include rows where numeric-expression is NULL. It returns NULL for a group containing no rows.

Standards and compatibility 
See also 

Aggregate functions

Example 

The following statement lists the average and variance in the number of items per order in different time periods:

SELECT year( ship_date ) AS Year,
    quarter( ship_date ) AS Quarter,
    avg( quantity ) AS Average,
    STDDEV_POP( quantity ) AS Variance
FROM sales_order_items
GROUP BY Year, Quarter
ORDER BY Year, Quarter
Year Quarter Average Variance
2000 1 25.775148 14.2794...
2000 2 27.050847 15.0270...
... ... ... ...

Contents Index STDDEV function [Aggregate] STDEV_SAMP function [Aggregate]