Mulai sekarangMulai gratis

Window functions with aggregations (I)

To familiarize yourself with the window functions, you will work with the Orders table in this chapter. Recall that using OVER(), you can create a window for the entire table. To create partitions using a specific column, you need to use OVER() along with PARTITION BY.

Latihan ini merupakan bagian dari kursus

Intermediate SQL Server

Lihat Kursus

Instruksi latihan

Write a T-SQL query that returns the sum of OrderPrice by creating partitions for each TerritoryName.

Latihan interaktif langsung praktik

Cobalah latihan ini dengan melengkapi kode contoh ini.

SELECT OrderID, TerritoryName, 
       -- Total price for each partition
       ___ 
       -- Create the window and partitions
       ___(___ TerritoryName) AS TotalPrice
FROM Orders
Edit dan Jalankan Kode