Skip to content

ROWNUM

SELECT ROWNUM, EMPLOYEE_ID, FIRST_NAME, LAST_NAME
FROM EMPLOYEES
WHERE ROWNUM <= 5;
| 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 |

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.