VARP
returns the statistical variance for the population of the given values.
This funcion ignores NULL
values.
Use VARP
if the given values represent the entire population.
Use VAR if the given values represent a sample.
This example return the variance for the population of all sales.
SELECT VARP(TotalAmount) AS 'Variance'
FROM [Order]
Variance |
---|
3957769.80164355 |
Syntax of the VARP function.
VARP(value)
value
-- a number or numeric column.
PRODUCT |
---|
Id |
ProductName |
SupplierId |
UnitPrice |
Package |
IsDiscontinued |
SUPPLIER |
---|
Id |
CompanyName |
ContactName |
City |
Country |
Phone |
Fax |
SELECT S.CompanyName,
VARP(UnitPrice) AS 'Price Variance'
FROM Product P
JOIN Supplier S ON S.Id = P.SupplierId
GROUP BY S.CompanyName
CompanyName | Price Variance |
---|---|
Aux joyeux ecclésiastiques | 15067.5625 |
Bigfoot Breweries | 3.55555555555554 |
Cooperativa de Quesos 'Las Cabras' | 72.25 |
Escargots Nouveaux | 0 |
Exotic Liquids | 16.2222222222222 |
Note: A value of 0 is returned when a supplier only has 1 product.