display the 5th lowest sal from emp table using Correlated subquery
table have data:
----------------
SQL> select last_name,salary from employee order by salary asc;
LAST_NAME SALARY
---------- ----------
Cat 1232.78
Martin 1234.56
Black 2334.78
Rice 2344.78
Smith 6544.78
Mathews 6661.78
6 rows selected.
SQL>
select x.* from (
select last_name, salary, rank() over(order by salary asc) as high_salary
from employee)x where x.high_salary = 5;
LAST_NAME SALARY HIGH_SALARY
---------- ---------- -----------
Martin 1234.56 5
select x.* from (
select last_name,salary, row_number() over(order by salary asc) as num
from employee)x where x.num = 5;
LAST_NAME SALARY NUM
---------- ---------- ----------
Martin 1234.56 5