ROWNUM
Example
Section titled “Example”SELECT ROWNUM, EMPLOYEE_ID, FIRST_NAME, LAST_NAMEFROM EMPLOYEESWHERE ROWNUM <= 5;Output
Section titled “Output”| ROWNUM | EMPLOYEE_ID | FIRST_NAME | LAST_NAME ||--------|-------------|------------|-----------|| 1 | 234 | John | Doe || 2 | 235 | Jane | Smith || 3 | 236 | Peter | Parker || 4 | 237 | Tony | Stark || 5 | 238 | Bruce | Wayne |Explanation
Section titled “Explanation”In the SQL example given, the ROWNUM pseudocolumn is used in conjunction with the WHERE clause to limit the output to the first 5 rows retrieved from the EMPLOYEES table. The column sequence for the output is ROWNUM, EMPLOYEE_ID, FIRST_NAME, LAST_NAME.