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
What is advantage of dbms?
What is meant by database system?
What is Schema in DBMS?
What is data model example?
Why do we need database?
What do you understand by database triggers?
Explain a join between tables?
Is the server accepting tcp ip connections on port 5432?
What are the objectives of rdbms?
List few ways to code transactions in an efficient manner?
Define database system.
Who is the founder of database?
Mention the differences between union and union all
What is normalization in database with example?
Explain armstrong rules? How they are complete and/or sound?