In MySQL I can do SELECT * FROM tbl LIMIT 10
In MSSQL I can do SELECT TOP 5 * FROM tbl
How do I do this in Postgresql?
In MySQL I can do SELECT * FROM tbl LIMIT 10
In MSSQL I can do SELECT TOP 5 * FROM tbl
How do I do this in Postgresql?
The syntax you quote for MySQL should work just fine for Postgresql as well. Doesn't it?
See the LIMIT
clause:
SELECT * FROM tbl LIMIT 10
or
SELECT * FROM tbl OFFSET 20
and, of course
SELECT * FROM tbl LIMIT 10 OFFSET 10
From the PostgreSQL docs:
SELECT select_list
FROM table_expression
[ ORDER BY ... ]
[ LIMIT { number | ALL } ] [ OFFSET number ]
So LIMIT should work as it does in MySQL. OFFSET is used to skip rows before starting to return data.
I hope this helps.