I'd like to collect the "state of the art" ways to paginate results for any database in this wiki.
Input: I have a huge table PAGE_ME:
create table PAGE_ME (
ID bigint not null,
NAME varchar(32) not null,
CREATED TIMESTAMP not null
)
id
is not necessarily in the same order as created
. I want to display the results between 5. May 2008 09:03:01
and 3. Aug 2008 11:00:01
, 20 at a time, ordered by time, ascending (5. May first). The query should return NAME
and CREATED
(plus whatever you need to paginate the result), so the inner query is:
select NAME, CREATED
from PAGE_ME
where CREATED between '2008-05-05 09:03:01' and '2008-08-03 11:00:01'
order by CREATED asc
On the keyboards, ready ... Go! ;)