Calculating standard deviation
Calculating the standard deviation is quite common when dealing with numeric columns. In this exercise, you will calculate the running standard deviation, similar to the running total you calculated in the previous lesson.
Latihan ini merupakan bagian dari kursus
Intermediate SQL Server
Instruksi latihan
Create the window, partition by TerritoryName and order by OrderDate to calculate a running standard deviation of OrderPrice.
Latihan interaktif langsung praktik
Cobalah latihan ini dengan melengkapi kode contoh ini.
SELECT OrderDate, TerritoryName,
-- Calculate the standard deviation
___
OVER(PARTITION BY TerritoryName ORDER BY OrderDate) AS StdDevPrice
FROM Orders