We already discussed the methods to use TOP functions in MySQL and in MSSQL.
In Oracle we make use of the ROWNUM function in the WHERE clause.
To take our names table again in this example, to get the first 5 rows, make use of the following query:
SELECT firstname,lastname FROM names WHERE ROWNUM <= 5
This will retrieve the first 5 records which are in the names table.
To get the first 50, use this query:
SELECT firstname,lastname FROM names WHERE ROWNUM <= 50
Related posts:
- Scaling up your MySQL server We use MySQL on most of our projects. One of...
- 11 MySQL resources you must read! Conditional joins in MySQL One way to do a “Conditional...
- A MySQL mojo leaves Oracle Ever since Oracle closed on its acquisition of MySQL, the...
- The 20 best practices when using MySQL Just came across this great article with 20 best practices...
- Starting up and shutting down a MySQL Server ...
Related posts brought to you by Yet Another Related Posts Plugin.