StDev() and StDevP() Function in MS Access
1. StDev() Function :
StDev() Function in MS Access is used to estimate the standard deviation for a population sample.
Syntax :
StDev (expr)
Parameter : This method accept one parameter as mentioned above and described below :
- expr : It represents a string expression identifying the field that contains the numeric data which we 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.
Returns : It calculates standard deviation for a population sample.
Note : If the underlying query contains fewer than two records or no records then it returns a Null value which indicates that a standard deviation cannot be calculated.
Table – ProcuctDetails
Product_Id | Product_Price |
---|---|
100000 | 90 |
200001 | 81 |
298700 | 34 |
345632 | 84 |
Example1 :
The standard deviation for the product price.
SELECT stDev(Product_Price) AS StDEV_Value FROM ProcuctDetails;
Output :
StDEV_Value |
---|
25.7730479377197 |
Example2 :
The standard deviation for only one record.
SELECT stDev(100) AS StDEV_Value ;
Output :
StDEV_Value |
---|
So, we can see it cannot be calculated.
2. StDevP () Function :
StDevP() Function in MS Access is used to estimate the standard deviation for a population. The main difference between the StDevP() function and StDev() function is StDevP evaluates a population, and the StDev evaluates a population sample.
Syntax :
StDevP (expr)
Parameter : This method accept one parameter as mentioned above and described below :
- expr : It represents a string expression identifying the field that contains the numeric data which we 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.
Returns : It calculates standard deviation for a population.
Note : If the underlying query contains fewer than two records then it returns a Null value which indicates that a standard deviation cannot be calculated.
Table – Products
P_Id | P_Price |
---|---|
1001 | 55 |
1005 | 20 |
1008 | 66 |
Example-1 :
SELECT stDevP(P_Price) AS StDEVp_Value FROM Procucts;
Output :
StDEVp_Value |
---|
24.0208242989286 |
Example-2 :
SELECT stDevP(10) AS StDEVp_Value;
Output :
StDEVp_Value |
---|