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 adalah bagian dari kursus
Intermediate SQL Server
Petunjuk latihan
Create the window, partition by TerritoryName and order by OrderDate to calculate a running standard deviation of OrderPrice.
Latihan interaktif praktis
Cobalah latihan ini dengan menyelesaikan kode contoh berikut.
SELECT OrderDate, TerritoryName,
-- Calculate the standard deviation
___
OVER(PARTITION BY TerritoryName ORDER BY OrderDate) AS StdDevPrice
FROM Orders