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 |
Compare and contrast between sql and sql server and explain its various functions?
What is schema?
41 Answers Bodhi Global Services, Cognizant, HCL,
types of indexes and the rationale behind choosing a particular index for a situation.
How do you store pictures in a database?
How do I limit the number of oracle database connections generated by weblogic server?
Explain the use of show option in imp command.
What are the different types of partitions in oracle?
How to see free space of each tablespace?
what is Table ?
Explain the difference between replace() and translate() functions in oracle?
How do I connect to oracle?
How to call a stored function in oracle?