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 is an oracle function?
State and explain the different types of data models?
Explain the use of analyse option in exp command.
Can you have more than one content canvas view attached with a window ?
What is a connect identifier?
How to convert dates to characters in oracle?
What is an oracle recycle bin?
What are triggers in oracle?
What are the set operators union, union all, minus & intersect meant to do?
Differentiate between pre-select and pre-query?
How to generate query output in html format?
How to login to the server without an instance?
Explain constraining triggers.
Why do we use bulk collect in oracle?
What is the difference between sharding and replication?