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
How to use events with zebedee, ssh or stunnel?
What is the difference between case version and decode version?
Which two can be implemented as a centrally located logical architecture?
What is domain in dbms?
Explain relational algebra?
What is e-r model in the dbms?
What is the purpose of using a model?
Define truncate and delete commands?
Is a database a file?
Which database is used by google?
What are different cursor types in dbms?
What are the different stages in 'data warehousing'?
i have table as source table and flat file as target i need yo perform some logic in loading the data. is it posible? and one more thing the no of fields in source is 200+ and for target is 30+ how i can map them.........
Explain dml (data manipulation language)?
How big is a big database?