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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / nathan
SELECT *
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER
BY sal DESC)
ranks
FROM emp)
WHERE ranks = 2;
Is This Answer Correct ? | 2 Yes | 1 No |
Is a rollback possible to any savepoint?
What different of iner joint & outer joint with example
What is raw datatype?
Is it possible to disable the parameter from while running the report ?
How to unlock the sample user account in oracle?
What privilege is needed for a user to create indexes in oracle?
What is cluster Key ?
What is an oracle database?
Explain the use of grant option in imp command.
what is the output of select * from emp where null=null & select * from emp where 1=1
What is parameterized cursor in oracle?
What is control file used for?