Search code examples
sqlpostgresqlsql-limit

How to limit rows in PostgreSQL SELECT


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


Solution

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

    SELECT * FROM users LIMIT 5;