select Nth highest salary by using rownum
Answer Posted / srinu
SELECT * FROM EMP WHERE SAL=(SELECT MIN(SAL) FROM ( SELECT
DISTINCT(SAL) FROM EMP ORDER BY SAL DESC) WHERE ROWNUM<'&N');
ANS::
EMPNO ENAME JOB MGR HIREDATE SAL
COMM DEPTNO
------ ---------- --------- ---------- --------- ----------
---------- ----------
7566 JONES MANAGER 7839 02-APR-81 2975
20
SELECT * FROM EMP WHERE SAL=(SELECT MIN(SAL) FROM ( SELECT
SAL FROM EMP ORDER BY SAL DESC) WHERE ROWNUM<'&N');
EMPNO ENAME JOB MGR HIREDATE SAL
COMM DEPTNO
------ ---------- --------- ---------- --------- ----------
---------- ----------
7788 SCOTT ANALYST 7566 19-APR-87 3000
20
7902 FORD ANALYST 7566 03-DEC-81 3000
20
Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
Plz send me Oracle Pl/Sql [1z0-147] dumps to this mail? sivakumarr1987@gmail.com
What is alternate key?
Give us a non-computer example of preemptive and non-preemptive scheduling?
What is unique key in dbms?
What are the benefits of modeling?
Why do we need database management?
Which is the most used database?
What is a distributed database system?
What are the steps in creating a database?
What is ddl in dbms?
What is correlated subquery in dbms?
What are the steps to follow when preparing to create a table?
What is the structure of a table in database?
Explain the advantages of rdbms?
What are the different types of keys in database?