Return estimates of the standard deviation for a population or a population sample represented as a set of values contained in a specified field on a query.
Syntax
StDev ( expr )
StDevP ( expr )
The expr placeholder represents a string expression identifying the field that contains the numeric data you want to evaluate or an expression that performs a calculation using the data in that field. Operands in expr can include the name of a table field, a constant, or a function (which can be either intrinsic or user-defined but not one of the other SQL aggregate functions).
Remarks
The StDevP function evaluates a population, and the StDev function evaluates a population sample.
If the underlying query contains fewer than two records (or no records, for the StDevP function), these functions return a Null value (which indicates that a standard deviation cannot be calculated).
You can use the StDev and StDevP functions in a query expression. You can also use this expression in the SQL property of a QueryDef object or when creating a Recordset object based on an SQL query.
Example
Expression |
Results |
SELECT stDev(UnitPrice) AS StDEV_Value, stDevP(UnitPrice) as StDEVP_Value FROM productSales; |
Calculates the Standard Deviation of "UnitPrice" considering the given data as sample and Standard Deviation of "UnitPrice" considering the given data as entire population and displays the results in StDE _Value and StDEVP_Value respectively. |