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 to do if the binary spfile is wrong for the default instance?
What are the attributes of cursor?
State the various uses of dbcc command?
What is connection pooling in oracle?
What are the various constraints used in oracle?
How many types of database triggers exist?
How to define a sub function?
What happens if you set the sga too low in oracle?
How to define an anonymous procedure with variables?
how to clone 9i Database on to 10g Database.
If any one has information regarding interview of NIC (National Informatics Centre),it would be of great help...
master table and child table performances and comparisons in Oracle ?
What are joins, explain all types of joins?
What is dynamic proxy?
Difference between varchar and varchar2 data types?