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
Explain compound trigger in oracle?
How to export several tables together?
What is the maximum limit on the number of columns in a table?
Explain oracle insert into command?
Calculate difference between 2 date / times in oracle sql?
Is oracle the best database?
Why do you create or replace procedures rather that drop and recreate.
What is a cognitive schema?
What is an oracle tablespace?
How to create an initialization parameter file?
What are the various oracle database objects?
How to define a variable to match a table column data type?
What is SQL access advisor in Oracle?
What is a sub query and what are the different types of subqueries?
What is the difference between I and G in Oracle?