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:
- Using TOP in MySQL queries On the web I see a lot of questions of...
- Using TOP in MS-SQL queries After I explained the MySQL method for getting the TOP...
- 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...
Related posts brought to you by Yet Another Related Posts Plugin.