Skip to content
Advertisement

PostgreSQL:How get last rows from a select query

See the below example,

And if I Execute

Will Get

So,How Can I Get the Last 2 Rows in select * from data?


What I’m expecting is….

Advertisement

Answer

You have two options according to your need i.e,

Or

LIMIT and OFFSET

if you want the 4th and 5th row just offset the first 3 so that the 4th row becomes the start of our set and you can specify a limit to say that you only want 2 rows from that.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement