Name
VAR_POP
Use VAR_POP to compute the population variance of a set of values.
ANSI SQL Standard Syntax
VAR_POP(numeric_expression
)
MySQL and PostgreSQL
MySQL and PostgreSQL support the ANSI SQL syntax.
Oracle
Oracle supports the standard syntax. It also supports the following analytic syntax:
VAR_POP(numeric_expression
) OVER (window_clause
)
For an explanation of the window_clause
, see the section later in this chapter titled “ANSI SQL Window Functions.”
SQL Server
Use the VARP function.
Example
The following example computes the population variance for the values 1, 2, and 3:
SELECT * FROM test;
X ---------- 1 2 3SELECT VAR_POP(x) FROM test;
VAR_POP(X) ---------- .666666667
Get SQL in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.