Name

STDDEV_POP

Use STDDEV_POP to find the population standard deviation within a group of numeric values.

ANSI SQL Standard Syntax

STDDEV_POP(numeric_expression)

MySQL, Oracle, and PostgreSQL

MySQL, Oracle, and PostgreSQL support the ANSI SQL syntax. Oracle also supports the following analytic syntax:

STDDEV_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 STDEVP function.

Example

The following example computes the population standard deviation for the values 1, 2, and 3:

SELECT * FROM test;
         X
----------
         1
         2
         3

SELECT STDDEV_POP(x) FROM test;
STDDEV_POP(X)
-------------
   .816496581

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.