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 end the current transaction in oracle?
What is execute immediate in oracle?
Can a formula column be obtained through a select statement ?
How will you identify oracle database software release?
How to use existing values in update statements using oracle?
Explain the function of optimizer in oracle?
What happens to the data files if a tablespace is dropped?
How to estimate disk space needed for an export job?
What is BBED in Oracle?
Explain integrity constraints?
11. Display the client number and name and the client number and name of the person who referred that client.
How can you use check constraints for self referential integrity?
What are advantages of dateset in datastage?
how to handle exceptions in post production
Which is faster join or subquery in oracle?