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.49766163752223 | 16.49766163752223 | 16.49766163752223 |
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 |
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.