GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 157 of 168    Print  
find manager for employee
ID employee department manager
----------------------------------------------
1 Suresh c++ NULL
2 Suresh c++ NUll
3 Suresh c++ 2
5 Sarathy testing 2
6 Rajaraman c# 1
7 joe Flash 1


I have the employee detail table ,In that i want to find the manager for each employee .
The employee name and manager column are present in same table



  
Total Answers and Comments: 4 Last Update: July 11, 2008     Asked by: rajaramanv 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 26, 2008 13:22:14   #1  
sahil4439 Member Since: May 2008   Contribution: 2    

RE: find manager for employee
select employee_manager
from talbe_name;

 
Is this answer useful? Yes | No
June 06, 2008 05:42:35   #2  
mktiwary Member Since: June 2008   Contribution: 1    

RE: find manager for employee
If you take the normal Oracle Employee (emp) table which consists of columns such as Employee Number (EMPNO) and Manager Number (MGR) then the query to find managers for all the employee is:

select e.ename as Employee, m.ename as Manager from emp e, emp m
where e.MGR = m.EMPNO

 
Is this answer useful? Yes | No
June 27, 2008 12:06:31   #3  
shiv_prakash Member Since: May 2008   Contribution: 2    

There is a '%' sign in one field of a column. What will be the query to find it.,,by Shiv prakash(4c+)
select column from table where column like '%' ESCAPE '' ;
 
Is this answer useful? Yes | No
July 11, 2008 07:16:35   #4  
krishnaveni_g Member Since: July 2008   Contribution: 9    

RE: find manager for employee
we can find manager for employee in the same table by using self join.

Ex:emp_id   emp_name   manager_id
       1          Smith            
       2          Rahul              1
       3          Sachin             2

Select e.emp_id,e.emp_name,m.last_name from
employees e, employees m
where e.manager_id = m.employee_id;

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape