std
Description
Returns the standard deviation of an expression. Since v2.5.10, this function can also be used as a window function.
Syntax
STD(expr)
Parameters
expr
: the expression. If it is a table column, it must evaluate to TINYINT, SMALLINT, INT, BIGINT, LARGEINT, FLOAT, DOUBLE, or DECIMAL.
Return value
Returns a DOUBLE value.
Examples
Sample dataset
=======
```plaintext
>>>>>>> 41ea837d3 ([Doc] add corr related functions and update window functions (#28776))
MySQL > select * from std_test;
+------+------+
| col0 | col1 |
+------+------+
| 0 | 0 |
| 1 | 2 |
| 2 | 4 |
| 3 | 6 |
| 4 | 8 |
+------+------+
Calculate the standard deviation of col0
and col1
.
MySQL > select std(col0) as std_of_col0, std(col1) as std_of_col1 from std_test;
+--------------------+--------------------+
| std_of_col0 | std_of_col1 |
+--------------------+--------------------+
| 1.4142135623730951 | 2.8284271247461903 |
+--------------------+--------------------+
keyword
STD