Collections:
Return Top 5 Rows in Oracle
How To Return Top 5 Rows in Oracle?
✍: FYIcenter.com
If you want the query to return only the first 5 rows, you can use the pseudo column called ROWNUM in the WHERE clause. ROWNUM contains the row number of each returning row from the query. The following statement returns the first 5 rows from the employees table:
SQL> SELECT employee_id, first_name, last_name
FROM employees WHERE ROWNUM <= 5;
EMPLOYEE_ID FIRST_NAME LAST_NAME
----------- -------------------- -------------
100 Steven King
101 Neena Kochhar
102 Lex De Haan
103 Alexander Hunold
104 Bruce Ernst
⇒ Understanding SQL Transaction Management in Oracle
⇐ Counting Groups Returned with the GROUP BY Clause in Oracle
2019-09-16, 2835🔥, 0💬
Popular Posts:
What Privilege Is Needed for a User to Delete Rows from Tables in Another Schema in Oracle? For a us...
How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the T...
How To Convert Numeric Values to Character Strings in MySQL? You can convert numeric values to chara...
Where to find SQL Server database server tutorials? Here is a collection of tutorials, tips and FAQs...
What is sqlservr.exe - Process - SQL Server (SQLEX?PRESS) in SQL Server? Process sqlservr.exe is the...