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 get the Installed Oracle Version Information ?
What is a dynamic performance view in oracle?
Difference between cartesian join and cross join?
Explain what are the characteristics of data files?
Can multiple columns be used in group by in oracle?
What is the usage of save points in oracle database?
How to delete a column in an existing table?
What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?
What happens internally when the user types userID/password@string in SQL PLUS Thanks-Bhaskar
What are the differences between blob and clob in oracle?
What is Redo Log Buffer in Oracle?
How to create tables for odbc connection testing?
What is the difference between "as" and "is" in an oracle stored procedure?
How would you change old and new values in an insert, delete and update triggers?
How to install oracle database 10g xe?