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



how can find the second max sal for every group(i.e i want group the data based on key and find th..

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

how can find the second max sal for every group(i.e i want group the data based on key and find th..

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

Post New Answer

More Oracle General Interview Questions

How to apply filtering criteria at group level in oracle?

0 Answers  


How to store only time; not date and time?

0 Answers  


How do you find current date and time in oracle?

0 Answers  


What is a read write transaction in oracle?

0 Answers  


WHAT IS ecc 6.0

0 Answers  






Calculate difference between 2 date / times in oracle sql?

0 Answers  


An automatic job running via DBMS_JOB has failedKnowing only that its failed, how do you approach troubleshooting this issue?

0 Answers  


How to invoke the data pump import utility?

0 Answers  


What are group functions in oracle?

0 Answers  


I know that i can create a table without a primary key.But is there any significance for that table???? while creating an application.

6 Answers  


What are the varoius components of physical database structure of oracle database?

0 Answers  


In Oracle Applications We are Using Sub Ledger Accounting. When we Transfer the Data all modules (AP,AR,CE,FA) to SLA We done Some customizations? What are They??

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)