MySQL STD() Function

The MySQL STD() function calculates the population standard deviation of all non-null input values ​​and returns the result. It is an alias for STDDEV_POP().

STD() Syntax

Here is the syntax for MySQL STD() function:

STD(expr)

Parameters

expr

Required. A column name or expression. It accepts a numeric or binary value.

Return value

The MySQL STD() function returns the population standard deviation of all non-null input values

Note that the STD() function only handles non-null values. That is, null values ​​are ignored by the STD() function.

If all input values ​​are null, the function will return NULL.

STD() Examples

To demonstrate usages of the MySQL BIT_AND() function, we simulate a temporary table using the following statement and UNION and SELECT:

SELECT 4 x
UNION
SELECT 5 x
UNION
SELECT 6 x;
+---+
| x |
+---+
| 4 |
| 5 |
| 6 |
+---+
3 rows in set (0.00 sec)

The following statement uses the STD() function to calculate the population standard deviation of all the values ​​in the x column:

SELECT STD(x)
FROM (
    SELECT 4 x
    UNION
    SELECT 5 x
    UNION
    SELECT 6 x
  ) t;
+-------------------+
| STD(x)            |
+-------------------+
| 0.816496580927726 |
+-------------------+