JetSQL » Functions » VARP

Syntax:
SELECT VARP ( field ) AS [ expression ]
FROM table
[ WHERE criteria ]
[ GROUP BY grouping_expression ]
[ HAVING criteria ]
field
The name of the column that the variance of the values is to be taken.
expression
The name to be displayed for the resulting variance.
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 VARP function finds the variance by using all of values in a field.

In comaparison, the VAR function only uses a portion, called a sample, of the values to calculate the variance. There must be at least two values in the field or the standard deviation will not be calculated and a NULL value is returned.

Examples

Code:
SELECT VARP(Age) AS [VarAge]
FROM MediCarePatients
Output:
VarAge
369.3328

(1 row(s) affected)
Explanation:

This code finds the variance of the age for all MediCare patients in a hospital and stores that information in 'VarAge'.

Language(s): MS SQL Server

See Also: