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
How many types of tables supported by oracle?
How to create a table index in oracle?
How to write date and time literals in oracle?
How to manage transaction isolation level?
Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.
What is a initialization parameter file in oracle?
What are a cluster and non-cluster index?
What is the order of defining local variables and sub procedures/functions?
Why does oracle 9i treat an empty string as null?
What is tns name?
What is a trigger oracle?
What would you do with an in-doubt distributed transaction?
How to list all tables in your schema?
How to connect to the server with user account: sys?
How to do a full database export?