STDEV
returns the standard deviation of the specified values.
STDEV
ignores NULL
values.
Use STDEV
if the values represent a sample, .
Use STDEVP if the values represent the entire population, .
This example returns the standard deviation of the sales.
SELECT STDEV(TotalAmount) AS 'Standard Deviation'
FROM [Order]
Standard Deviation |
---|
1990.6139633244 |
Syntax of the STDEV function.
STDEV(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,
STDEV(UnitPrice) AS 'Price Standard Deviation'
FROM Product P
JOIN Supplier S ON S.Id = P.SupplierId
GROUP BY S.CompanyName
CompanyName | Price Standard Deviation |
---|---|
Aux joyeux ecclésiastiques | 173.594714781297 |
Bigfoot Breweries | 2.3094010767585 |
Cooperativa de Quesos 'Las Cabras' | 12.0208152801713 |
Escargots Nouveaux | NULL |
Exotic Liquids | 4.93288286231625 |
Note: A NULL value is returned when a supplier has fewer than 2 products.