JetSQL » Functions » STDEV

Syntax:
SELECT STDEV ( field ) AS [ expression ]
FROM table
[ WHERE criteria ]
[ GROUP BY grouping_expression ]
[ HAVING criteria ]
field
The name of the column that the sample standard deviation of the values is to be taken.
expression
The name to be displayed for the resulting standard deviation.
table
The name of the table the information is being retrieved from.
criteria
The condition(s) that dictate which rows are to be calculated.
grouping_expression
An optional parameter that specifies a set of columns on which to group matching data.

The STDEV function finds the standard deviation by using a portion, called a sample, of the total number of values in a field.

This is a time saver when dealing with extremely large tables and can be shown to be statistically valid. In comparison, the STDEVP function uses all of the values to calculate the standard deviation. There must be at least two values in the field or the standard deviation will not be calculated and a NULL is returned.

Examples

Code:
SELECT STDEV(Age) AS [SDAge]
FROM MediCarePatients
Output:
SDAge
19.59862

(1 row(s) affected)
Explanation:

This code finds the standard deviation of the age of the MediCare patients in a hospital (by using a sample) and stores that information in 'SDAge'.

Language(s): MS SQL Server

See Also: