Answer Posted / prabhudatta barick
--IN ORDER TO FIND THE NTH HIGHEST SALARY,
--WE JUST FIND THE SALARY THAT HAS EXACTLY N-1 SALARIES
GREATER THAN ITSELF---
--This is correlated subquery--
select empno,
ename,
sal
from scott.emp e
where &n-1=(select count(distinct b.sal) from scott.emp b
where b.sal>e.sal);
To get second highest salary put n value 2.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How to check the server version in oracle?
What is data file?
Which is better Oracle or MS SQL? Why?
Why is oracle database so popular?
What are the major difference between truncate and delete?
What are the various constraints used in oracle?
Explain what are the different type of segments?
Is postgres faster than oracle?
How to do paging with oracle?
How can we find out the current date and time in oracle?
What is recovery manager(rman) backup in Oracle?
How to open a cursor variable?
What do you mean by a tablespace?
What is max rowid in oracle?
Is oracle a programming language?