TOP and LIMIT in different databases

If you want to limit the number of rows returned by a query, the syntax is different across different databases.




Postgresql:
SELECT field1 FROM table1 LIMIT 10

MS SQL Server:
SELECT TOP 10 field1 FROM table1

ORACLE:
SELECT field1 FROM table1 WHERE ROWNUM <= 10

mySQL:
SELECT field1 FROM table1 LIMIT 10

Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

0 commenti: