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 do you create a blank database?
What are the different types of keys in database?
Which is the most used database?
What is system r?
What are the examples of database management system?
What is database in simple language?
What is string in database?
What are the features of openedge features?
what is normalization? types of normalization? example of each form? how do u implement normalization in ur project?
Which parameters are optional in init.ora parameter file?
How to use multiple database server in back end ?
What is openedge rdbms?
Why do not you use gnu autoconf or scons for building?
List few disadvantages of file processing system.
Write a query to remove duplicate rows from a table?