In continuation of previous blog:
- Pagination: This feature focuses on the result set of T-sql. It divides the result set into different parts to view easily. We can do pagination by using ‘OFFSET’ and ‘FETCH’ commands. We can pull only the required number of records instead of all.
There is an emp table and we are applying pagination on the same.
Here I have applied pagination for 0 to 5 records.
Few points to ponder:
- ORDER BY is mandatory to use OFFSET and FETCH clause
- OFFSET clause is mandatory with FETCH. You can never use, ORDER BY … FETCH.