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 |
What are the types of Database Links ?
Explain oracle’s system global area (sga).
What is a system tablespace and when it is created?
What is the simplest tool to run commands on oracle servers?
Explain the difference between a procedure and a function?
What is an oracle transaction?
How many types of database triggers exist?
How to change system global area (sga) in oracle?
How to define Data Block size ?
What are privileges and grants?
How would you optimize a slow SQL query?
can we pass two out parameters at a time in function?please answer to my question