Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Intermediate SQL Server

Cursus bekijken

Oefeninstructies

Create the window, partition by TerritoryName and order by OrderDate to calculate a running standard deviation of OrderPrice.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT OrderDate, TerritoryName, 
       -- Calculate the standard deviation
	   ___ 
       OVER(PARTITION BY TerritoryName ORDER BY OrderDate) AS StdDevPrice	  
FROM Orders
Code bewerken en uitvoeren