w3resource

MySQL STDDEV_POP() function

STDDEV_POP() function

MySQL STDDEV_POP() function returns the population standard deviation of an expression ( the square root of VAR_POP()). Statistically, the population standard deviation quantifies how much variation there is in a dataset.

It returns NULL if no matching row is found.

This function is useful in -

  • The primary purpose of the STDDEV_POP() function is to accurately calculate the population standard deviation.
  • STDDEV_POP() quantifies the spread or dispersion of values around the mean (average) in a dataset.
  • The population standard deviation helps you understand the variability or consistency of data points within the entire population.
  • Population standard deviation is used to calculate confidence intervals for population parameters.
  • You can use population standard deviation to compare the variability of different populations or datasets and assess their similarity or difference.
  • In finance and risk analysis, population standard deviation is used to measure the volatility or risk associated with investment returns or financial instruments.

Syntax:

STDDEV_POP(expr);

Where expr is an expression.

MySQL Version: 8.0

Example: MySQL STDDEV_POP() function

The following statement returns the standard deviation of 'total_cost' from purchase table.

Sample table: purchase


Code:

SELECT STDDEV_POP(total_cost)   
FROM purchase;

Output:

mysql> SELECT STDDEV_POP(total_cost)   
    -> FROM purchase;
+------------------------+
| STDDEV_POP(total_cost) |
+------------------------+
|             315.392172 | 
+------------------------+
1 row in set (0.00 sec)

Previous: STD()
Next: STDDEV_SAMP()



Follow us on Facebook and Twitter for latest update.