MySQL STDDEV() Function: Measure population standard deviation

STDDEV() measures the population standard deviation of a set of numeric values. STDDEV_POP() and STD() are equivalent in MySQL.

STDDEV(): Quick SQL Example

Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.

SELECT ROUND(STDDEV_POP(v), 2) AS population_stddev FROM (SELECT 2 AS v UNION ALL SELECT 4 UNION ALL SELECT 6) AS sample;
population_stddev
1.63
On this page — Show page sectionsHide page sections

More SQL Examples and Explanations

Standard deviation query

STDDEV() returns the population standard deviation of non-NULL values. STD() and STDDEV_POP() are synonyms for the same population calculation.

The examples use the student table SQL dump.

SELECT STDDEV(mark), STD(mark), STDDEV_POP(mark)
FROM student;
STDDEV(mark)STD(mark)STDDEV_POP(mark)
16.4976616375222316.4976616375222316.49766163752223

Using FORMAT()

Use FORMAT() when you want a formatted string with a fixed number of decimal places.

SELECT FORMAT(STDDEV(mark), 2)
FROM student;
FORMAT(STDDEV(mark), 2)
16.50

How to Interpret the Result

Use STDDEV_SAMP() when the values are a sample rather than an entire population. Aggregate functions ignore NULL values.

Common Question

Is STDDEV() the sample standard deviation?
No. In MySQL STDDEV() is a synonym for population standard deviation; use STDDEV_SAMP() for a sample.

↑ Back to top




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer