Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee respective manager.. example
empno ename mgr_id
1 john 3
2 paul 3
3 smith 1
4 kevin 1
5 stewart 2

result has to look like this

ename manager
john smith
paul smith
smith john
kevin john
stewart paul


can u plz help me out in this.....

Answers were Sorted based on User's Feedback



i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / praveen h

I think this one will work
Select a.ename as Employee ,b.ename as Manager from
EMP ,EMP B
where
A.MGR_ID=B.empno

Is This Answer Correct ?    9 Yes 2 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / rajesh venati

select e.ename as employee_name,m.ename as manager_name from
emp e, emp m where e.mgr_id=m.empno;

Is This Answer Correct ?    8 Yes 2 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / adil

I think this one will work
Select a.ename as Employee ,b.ename as Manager from
EMP ,EMP B
where
A.MGR_ID=B.empno

Is This Answer Correct ?    1 Yes 0 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / cbigmudre

select a.ename, b.enanme as manager
from emp as a, emp as b
where a.empno = b.mgr_id

Is This Answer Correct ?    2 Yes 1 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / karthik

select e1.empno,e1.ename EmpName,e2.ename MgrName from emp e1,emp e2
where e1.mgr_id=e2.ename(+);

select e1.empno,e1.ename EmpName,e2.ename MgrName
from emp e1 left outer join emp e2
where e1.mgr_id=e2.ename;

Is This Answer Correct ?    0 Yes 0 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / sudhan

select e1.ename EmpName,e2.ename MgrName from emp e1,emp e2
where e1.mgr_id=e2.ename;

Is This Answer Correct ?    0 Yes 1 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / john bershan

self join will accomplish this task.try below query

select a.ename,b.ename as manager from emp a,emp b
where a.empno = b.mgrid;

Is This Answer Correct ?    0 Yes 1 No

i have a table emp and columns ename,empno,mgr_id,i need ename,manager name as result i.e employee r..

Answer / monika

select empno,ename
from emp
start with mgr_id is null
connect by prior empno=mgr_id;

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

Can a trigger call a stored procedure?

0 Answers  


What are procedures used for?

0 Answers  


What is snowflake sql?

0 Answers  


Table Order_Name has a column Order_Date which gives the date & Time at which the order is passed.Find the table to write a query to find out the latest order.

5 Answers   Thomson,


What is a unique key?

0 Answers  


Can sql developer connect to db2?

0 Answers  


What are the types of dbms?

0 Answers  


how to select unique records from a table? : Sql dba

0 Answers  


What is a database trigger ? Name some usages of database trigger ?

4 Answers  


Where are my tempfiles, I don't see them in v$datafile or dba_data_file?

0 Answers  


Does pl sql work in mysql?

0 Answers  


explain the difference between myisam static and myisam dynamic. : Sql dba

0 Answers  


Categories