Multiple choice

What is the output of the given query? SELECT ROWNUM,ENAME,SAL FROM EMP WHERE ROWNUM<=2

  1. It shows only the second record.

  2. It shows only the record 1 and 2.

  3. It shows no row rows selected.

  4. None of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The query returns no rows. This is because ROWNUM is assigned BEFORE the WHERE clause filter is applied. When you filter with ROWNUM <= 2, Oracle tries to assign row numbers, but the WHERE clause eliminates rows before ROWNUM can be properly assigned. The condition ROWNUM <= 2 never allows any row to be returned. To limit rows, use ROWNUM in a subquery or use FETCH FIRST in modern Oracle.