VAR_POP

<< Click to Display Table of Contents >>

Navigation:  Streaming SQL Reference Guide > Basic Building Blocks > Functions > Aggregate Functions > Statistical Variance and Deviation Functions >

VAR_POP

Previous pageReturn to chapter overviewNext page

Returns the population variance of a non-null set of numbers (nulls being ignored)

VAR_POP ( [DISTINCT | ALL] number-expression )

 

where ALL includes (and DISTINCT excludes) duplicate values in the input set. ALL is the default. When the the input set has no non-null data, VAR_POP returns NULL.

VAR_POP uses the following calculation:

(SUM(expr*expr) - SUM(expr)*SUM(expr) / COUNT(expr)) / COUNT(expr)

In other words, for a given set of non-null values, using S1 as the sum of the values and S2 as the sum of the squares of the values, VAR_POP returns the result (S2-S1*S1/N)/N.

You can use VAR_POP as either an aggregate and analytic function. Applied to an empty set, it returns null.

See also sample variance, VAR_SAMP, STDDEV_POP, and STDDEV_SAMP.