1SELECT
2 ROW_NUMBER() OVER (
3 ORDER BY first_name
4 ) row_num,
5 first_name,
6 last_name,
7 city
8FROM
9 sales.customers;
10
1
2
3
4
5 SELECT
6 ROW_NUMBER() OVER (
7 ORDER BY first_name
8 ) row_num,
9 first_name,
10 last_name,
11 city
12FROM
13 sales.customers;
1USE AdventureWorks2012;
2GO
3WITH OrderedOrders AS
4(
5 SELECT SalesOrderID, OrderDate,
6 ROW_NUMBER() OVER (ORDER BY OrderDate) AS RowNumber
7 FROM Sales.SalesOrderHeader
8)
9SELECT SalesOrderID, OrderDate, RowNumber
10FROM OrderedOrders
11WHERE RowNumber BETWEEN 50 AND 60;
12