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.
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.
Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]