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 do u mean by canvases and alerts?
what are the different levels of database schema?
What exactly is a database?
What are new features postgre 9.1?
Explain 4nf?
How can I create database in excel?
What are the properties of a primary key in DBMS?
What is database url?
How do you exit a database?
What does fill factor concept mean with respect to indexes?
Explain what is a deadlock and mention how it can be resolved?
Define join and enlist its types.
What do you understand by fragmentation?
What you mean by Object Relational DBMS?
How do you create a blank database?