You have one employee table having 3 entries emp_id, Mgr_id
and salary. Mgr_id is also referencing emp_id. so now find
out the emp_id which are having the second highest salary,
under a particular manager.

Answer Posted / rajesh

select * from (select
emp_id,mgr_id,salary,dense_rank()over(partition by mgr_id order by salary desc nulls last) rn from emp) where rn=2;

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How much memory your 10g xe server is using?

578


Why do I get unexpected characters from 8-bit character sets in weblogic jdriver for oracle?

602


How to change system global area (sga) in oracle?

566


How to use subqueries in the from clause in oracle?

575


How many objectname will be created for a single table drop function? Why 'flashback' query giving error "ORA-38312: original name is used by an existing object" while getting the table?

1797






How can we view last record added to a table?

591


HI, Please let me know the syllabus for Oracle OCA and OCP Certification

1943


Typically, where is the conventional directory structure chosen for Oracle binaries to reside?

1574


How to import one table back from a dump file?

585


What is Redo Log Buffer in Oracle?

619


Describe an oracle table?

565


Why we use bulk collect in oracle?

528


How to add a new column to an existing table in oracle?

576


Hi Masters, in Oracle Applications 11i, we hace 2 functions using the same form, i need to create 1 personalization, but that code must afect only one function.... how can i do that?

1766


We are using Oracle apps with XML publisher.In that,we are facing some problems while giving a Footer in RTF Template.While giving a footer in RTF Template it is Visible in all the pages,but after the PDF is getiing generated,the Footer are Visible on alternate pages only (like on first page ,third page) and so on. Please provide the Solution for getting the Footer on all the pages.

4925