----Basic but important functions --ROW_NUMBER() --RANK() --DENSE_RANK() --NTILE()
--ROW_NUMBER() --Returns a sequential row number with in partition of result set use Northwind; SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products;
----Getting alternate rows ------Odd Row select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.]%2=1; ------Even Row select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.]%2=0; ------Row Between select * from (SELECT ROW_NUMBER() over(order by productid) as [Row No.], ProductName from Products) p where p.[Row No.] Between 5 and
... Read more »