How to limit rows in PostgreSQL SELECT

Dan Mertz picture Dan Mertz · Jul 15, 2009 · Viewed 103k times · Source

What's the equivalent to SQL Server's TOP or DB2's FETCH FIRST or mySQL's LIMIT in PostgreSQL?

Answer

Sinan Taifour picture Sinan Taifour · Jul 15, 2009

You can use LIMIT just like in MySQL, for example:

SELECT * FROM users LIMIT 5;