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.
Answers were Sorted based on User's Feedback
Answer / kumar mrityunjay singh
SELECT *
FROM (SELECT EMPLOYEE_ID,MANAGER_ID,SALARY,DENSE_RANK() OVER(ORDER BY SALARY DESC)RN FROM EMPLOYEES WHERE MANAGER_ID='&ENTER_MANAGER_ID')WHERE RN < '&VALUE_UPTO'
/
| Is This Answer Correct ? | 8 Yes | 4 No |
Answer / 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 |
Answer / chandra reddy
select empno,ename,deptno,sal from(select e.*,b.sal,rank()over(order by sal desc)send_h from em e join em1 b on e.empno=b.empno) where send_h=2
| Is This Answer Correct ? | 1 Yes | 1 No |
is there a tool to trace queries, like profiler for sql server?
In what script is snap$ created? In what script is the scott/tiger schema created?
Please explain drop constraint oracle?
Explain view?
Which environment variables are absolutely critical in order to run the OUI?
What is meant by an index?
How to define a record variable to store a table row?
what is the maximum number of indexes i can create for a table? What happens if i create indexes for all the columns of a table? Will it slow down the speed of retrieval
how to get count of tables in particular database in Oracle?
what are the diffeenes between oracle 9i,oracle 10g
How can we manage the gap in a primary key column created by a sequence? Ex:a company has empno as primary key generated by a sequence and some employees leaves in between.What is the best way to manage this gap?
What are the differences between char and nchar in oracle?