// aggregates reference

SQL STDDEV_POP function

Population standard deviation: divides by n and treats the group as the whole population.

Categoria
Aggregates
Returns
numeric
In this category
21 of 52

Sintaxe

STDDEV_POP(x) | STDEVP(x) | STDDEV_POP(x) OVER (...)

Suporte a mecanismos

MotorSupportNotas
SQL Server Different name or syntax STDEVP is the SQL Server spelling
PostgreSQL Sim Supported under this name.
MySQL Sim Supported under this name.
SQLite Not built in not built in; use an extension or compute it manually
Oracle Sim Supported under this name.

Exemplos

PostgreSQL

SELECT stddev_pop(price) FROM products WHERE category_id = 7;

SQL Server

SELECT STDEVP(price) FROM products WHERE category_id = 7;

Bom saber

  • One non-NULL value returns 0 (unlike STDDEV_SAMP's NULL) because there is no n-1 division.
  • NULLs are excluded; the denominator is the count of present values.
  • Use the sample form when your rows are a sample of something bigger; population form when the rows are everything you care about.

Questions about STDDEV_POP

STDDEV_POP vs STDDEV_SAMP?

The divisor: n versus n-1. STDDEV_POP returns 0 for a single row; STDDEV_SAMP returns NULL.

What is STDDEV_POP in SQL Server?

STDEVP.

How does it relate to variance?

It is the square root of VAR_POP.

Browse every function in the SQL function reference, or see what the SQLly desktop app does for your database.

Cheat sheets for the engines that have it: SQL Server, PostgreSQL, MySQL, Oracle.

// fewer lookups

Functions your engine actually has

SQLly's completion lists the built-in functions of the engine you're connected to, whether that's SQL Server, PostgreSQL, MySQL, SQLite or Oracle. Hover a function for help, and signature hints show each argument as you type.