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, 3189🔥, 0💬
Popular Posts:
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...
How REAL and FLOAT Literal Values Are Rounded in SQL Server Transact-SQL? By definition, FLOAT(n) sh...
How To Find Out What Privileges a User Currently Has in Oracle? Privileges granted to users are list...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How To Create a Stored Program Unit in Oracle? If you want to create a stored program unit, you can ...