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
What are the various types of snapshots ?
How i can handle exception in large code like 1000 line without distrubing the code or without exception handler sction?
How to use values from other tables in update statements using oracle?
What is the simplest tool to run commands on oracle servers?
What is a Garbage Collection? and what is full recursive Garbage collection?
What would you do with an in-doubt distributed transaction?
How to convert dates to characters in oracle?
Is it possible to insert comments into sql statements return in the data model editor ?
What is a snapshot log?
What is sharded cluster?
how the Oracle Prepares the Execution Plan and how it chooses the Optimal one?
What are the advantages of oracle 12c?
What is the difference between "as" and "is" in an oracle stored procedure?
Explain what are the different type of segments?
what is meant by magic query