ComenzarEmpieza gratis

Crear totales continuos

Normalmente no tienes que utilizar ORDER BY cuando utilices agregaciones, pero si quieres crear totales corridos, ¡deberás ordenar tus filas! En este ejercicio, crearás un total continuo de OrderPrice.

Este ejercicio forma parte del curso

Intermedio SQL Servidor

Ver curso

Instrucciones de ejercicio

Crea la ventana, divide por TerritoryName y ordena por OrderDate para calcular un total corrido de OrderPrice.

Ejercicio interactivo práctico

Pruebe este ejercicio completando este código de muestra.

SELECT TerritoryName, OrderDate, 
       -- Create a running total
       ___ 
       -- Create the partitions and arrange the rows
       ___(___ TerritoryName ___ OrderDate) AS TerritoryTotal	  
FROM Orders
Editar y ejecutar código