Assigning row numbers
Records in T-SQL are inherently unordered. Although in certain situations, you may want to assign row numbers for reference. In this exercise, you will do just that.
Bu egzersiz
Intermediate SQL Server
kursunun bir parçasıdırEgzersiz talimatları
Write a T-SQL query that assigns row numbers to all records partitioned by TerritoryName and ordered by OrderDate.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
SELECT TerritoryName, OrderDate,
-- Assign a row number
___
-- Create the partitions and arrange the rows
OVER(PARTITION BY TerritoryName ORDER BY OrderDate) AS OrderCount
FROM Orders