Let’s talk today one more important clause of “DENALI” which is very helpful in fetching records, paging are “OFFSET” & “FETCH”.
It is helpful in performance improvement also.
Just go through below example and it will clear more
Suppose I have state table which have all the state rows of INDIA.
Now with offset clause I can say from where I can start row fetching and FETCH NEXT will give me option how many rows I want.
So suppose I want 5 records after and skip first 2 rows then see below SQL statement
SELECT * FROM state ORDER BY StateName OFFSET 2 ROWS FETCH NEXT FROM 5 ROWS ONLY