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 |
23. Display the client name for all clients who have placed an order where any order line has more than 3 items. Do not use a table join anywhere in your query.
find out the third highest salary?
92 Answers CIPL, Cyber Shot, HCL, Hewitt, IBM, JPMorgan Chase, Orion, Verizon,
how to get last monday of a month?
What are ddl statements in oracle?
How to return top 5 rows in oracle?
Where do we use decode and case statements?
The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE THE OUTPUT) Write the query plz. A B C ---------- 1 NULL 7 2 4 NULL NULL 5 NULL 3 NULL NULL
How to download oracle database 10g xe?
does the query needs a hint to access a materialized view?
What is bulk load in oracle?
Can you create a synonym without having a table?
What are the types of Database Links ?