Var() and VarP() Function in MS Access

1. Var() Function :
Var() Function in MS Access is used to estimate the variance for a population sample.

Syntax :

`Var(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 variance 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 variance cannot be calculated.

Table – ProductDetails

Product_Id Product_Price
100000 90
200001 81
298700 34
345632 84

Example-1 :
The variance of the product price.

```SELECT Var(Product_Price) AS Var_Value
FROM ProcuctDetails;```

Output :

Var_Value
664.25

Example-2 :
Variance for only one record.

`SELECT Var(100) AS Var_Value ;`

Output :

Var_Value

So, we can see it can not be calculated.

2. VarP () Function :
VarP () Function in MS Access is used to estimate the variance for a population. The main difference between The VarP () function and VarP() Function is VarP evaluates a population, and the Var function evaluates a population sample.

Syntax :

`VarP(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 variance 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 VarP (P_Price) AS VarP_Value
FROM Procucts;```

Output :

VarP_Value
384.666666666667

Example-2 :

`SELECT VarP (10) AS VarP_Value;`

Output :

VarP_Value
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.