SELECT
ROW_NUMBER() OVER (ORDER BY ProductID) AS RowNum,
ProductID,
ProductName,
UnitPrice
FROM Products
SELECT
ROW_NUMBER() OVER (PARTITION BY CategoryID ORDER BY ProductID) AS RowNum,
ProductID,
ProductName,
CategoryID
FROM Products
SELECT
*
FROM (
SELECT
ProductID,
ProductName,
CategoryID,
ROW_NUMBER() OVER (PARTITION BY CategoryID ORDER BY ProductID) AS RowNum
FROM Products
) AS RankedProducts
WHERE RowNum <= 2
SELECT
ROW_NUMBER() OVER (ORDER BY UnitPrice DESC) AS RowNum,
ProductID,
ProductName,
UnitPrice
FROM Products