0

In PostgreSQL: To retrieve 100 rows using an SQL query we can use LIMIT 100. Is there a way to retrieve first 100 rows and later the next 100 like doing some kind of pagination? i.e.

if I do something like:

SELECT ..... LIMIT 100;

and later execute a command like:

SELECT ... LIMIT 100

I could get the next 100 rows to the previous retrieval of 100 rows and so on?

Thanks in advance

Jose Cabrera Zuniga
  • 2,348
  • 3
  • 31
  • 56
  • Does this answer your question? [How to limit rows in PostgreSQL SELECT](https://stackoverflow.com/questions/1133944/how-to-limit-rows-in-postgresql-select) – Code-Apprentice Aug 17 '21 at 14:45

1 Answers1

1

Yes, you need to use limit combined with offset. You can find more details here

select * from table LIMIT 100 OFFSET 100*0 --first 100
select * from table LIMIT 100 OFFSET 100*1 --second 100