VARIANCE: population standard variance
MySQL aggregate function VARIANCE() returns population standard variance of the input field / data. It returns NULL if no matching row is found.
VARIANCE() is synonym of the sql function VAR_POP().
VAR_SAMP() returns the sample variance .
Here are some examples using our student table.
SELECT VARIANCE(mark),VAR_POP(mark), VAR_SAMP(mark) FROM `student`
Output is here
VARIANCE(mark) | VAR_POP(mark) | VAR_SAMP(mark) |
272.1728395061727 | 272.1728395061727 | 282.6410256410255 |
By using FORMAT()
Restrict decimal places by using FORMAT()
SELECT FORMAT(VARIANCE(mark),2) FROM `student`
Output is here
FORMAT(VARIANCE(mark),2) |
272.17 |
This article is written by plus2net.com team.
plus2net.com
▼ More on Math functions in SQL
|