I am confused with the pagination variables limit and skip. My question is if we use skip, for eg. limit=50 and skip=20, then will 20 entries be skipped from the 50 entry limit or the response will contain 50 entries but they will be after the 20 first entries (depending on the order clause)?
1 Answer
Accepted Answer
Some basic Different between LIMIT and SKIP keywords. LIMIT <skip>, <count> is equivalent to: LIMIT <count> OFFSET <skip> i.e Case 1 : LIMIT <skip>, <count> select * from tableDemo LIMIT 3,10 Output : Total we have 10 records in tableDemo . in which we are skip first 3 records [ Skiping recordes ascending order ] . if we are try out with select * from tableDemo order by id desc LIMIT 3,10 Output : Total we have 10 records in tableDemo . in which we are skip first 3 records with order by descending cluse so we are skiping last 3 records , in our case (8,9,10 ) id's Case 2 : LIMIT <count> OFFSET <skip> select * from tableDemo LIMIT 10 OFFSET 1 
same output for Case 2 , just syntax different.
Your Answer
Think you can help? Login to answer this question!