how can find the second max sal for every group(i.e i want
group the data based on key and find the second max sal for
every group
Answer Posted / sudipta santra
select max(sal),group_nm from
( select sal,dense_rank over (order by sal desc) rank,group_nm
from emp )
where rank=&n
group by group_nm;
Note: here &n is the bind variable which holds value from
the user, based on the requirement either 2nd max or 3rd max
or 5th max.
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
What are the benefits of ordbms?
What do you understand by a database object?
What is index in Oracle?
How to write date and time interval literals in oracle?
Can we store pictures in the database and if so, how it can be done?
How to download oracle database 10g xe?
Can we call procedure inside function in oracle?
What are the differences between char and nchar in oracle?
Explain the use of log option in exp command.
What happens if recursive calls get out of control?
What is ordinary table in oracle?
How to compare dates in oracle sql?
How to define and use table alias names in oracle?
What are the differences between primary key and unique key?
i wrote a pl/sql procedure. it must run every sunday 4.40 How can i schedule it with the help of dbms_jobs (or another other procedure with out creating bat file,exe file)