We can use OFFSET and FETCH keywords to select specific number of rows in SQL Select query.
- SELECT *
- FROM Tablename
- ORDER BY colname
- OFFSET 0 ROWS
- FETCH NEXT 10 ROWS ONLY
The above query will returns first 10 records.
- SELECT *
- FROM Tablename
- ORDER BY colname
- OFFSET 10 ROWS
- FETCH NEXT 10 ROWS ONLY
Above query will returns records 11 to 20.
Likewise you can increase OFFSET values to get next set of records.