 <p>The exact sql query depends on what type of SQL server you have used.</p> <p>For example in MySQL you can paginate by LIMIT and OFFSET at the end of a query.</p> <p>SELECT something FROM table LIMIT 20, 40</p> <p>It says that you get 20 records from 40. position.</p>