When using value based pagination
select * from articles
where id > @start_value
limit @page_size
how can I calculate @start_value
given only page number?
Namely: say, I had a website and html page with a list of articles that I needed to paginate. But even to render the very 1st page, I'd need to calculate @start_value
somehow. The input from a user would be a number of a page which he clicked; for the very first page it'd be 1 - by default.
given that 1, how would I calcualate
@start_value
?or given any random page, still how would I calcualate
@start_value
?
Note that the values of the column id
of a table aren't necessarily sequential, even if id
is autoincremented.