MulaiMulai sekarang secara gratis

Window functions with aggregations (II)

In the last exercise, you calculated the sum of all orders for each territory. In this exercise, you will calculate the number of orders in each territory.

Latihan ini adalah bagian dari kursus

Intermediate SQL Server

Lihat Kursus

Petunjuk latihan

  • Count the number of rows in each partition.
  • Partition the table by TerritoryName.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

SELECT OrderID, TerritoryName, 
       -- Number of rows per partition
       ___ 
       -- Create the window and partitions
       ___ AS TotalOrders
FROM Orders
Edit dan Jalankan Kode