I am new to sql (and sqlite) and so far I have learned that I need to use count to get the number of rows returned by a query. However if I get for example 10’000 results and would like to divide them into 10 “pages” I would like to show only results 0-1’000 on one page , 1’000-2’000 on another page and so on.
How should I write a sql query that shows only the results I am intrested in? I guess I would have to do something like this:
select *
from sometable
where somecol like '%whatever%'
AND resultcount > 1000
AND resultcount < 2000;
I apologize if this has been answered before but I do not know what I should search for and so far I have not found any solutions that are simple enough for a beginner 😉
You could use the LIMIT and OFFSET feature of sqlite.
LIMIT X OFFSET Yis a LIMIT of X records, with a Y OFFSETso
LIMIT 10 OFFSET 50will return 10 records, with a 50 record offset.There is also
LIMIT <skip>, <count>syntax if you prefer that style