STDEV Function
The STDEV function computes the standard deviation
of a data set, which is the square root of the VARIANCE function.
You can apply the STDEV function only to numeric columns. The
next query finds the standard deviation:
SELECT STDEV(age) FROM u_pop WHERE u_pop.age > 0;
As with the other aggregates, the STDEV function
applies to the rows of a group when the query includes a GROUP BY
clause, as this example shows:
SELECT STDEV(age) FROM u_pop GROUP BY birth WHERE STDEV(age) > 0;
NULL values are ignored unless every value in the specified
column is NULL. If every column value is NULL, STDEV returns
a NULL for that column.
Important: All
computations for the STDEV function are performed in 32-digit
precision, which should be sufficient for many sets of input data.
The computation, however, loses precision or returns incorrect results
when all of the input data values have 16 or more digits of precision.
You cannot use this function on columns of type DATE.
Within a SELECT Statement with GROUP BY clause, STDEV returns
a zero variance for a count of 1. You can omit this special case through
appropriate query construction (for example, "HAVING COUNT(*)
> 1
"). Otherwise, a data set that has only a few cases might
block the rest of the query result.