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.....

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

what is union? : Sql dba

579


What do you understand by pl/sql records?

528


What is Histogram?

1098


What is sql trigger example?

534


What is the use of <> sql?

548






What is keys and its types?

535


Differentiate between pl/sql and sql?

613


How do I create a sql database?

518


What are the types of views in sql?

535


What is triggering circuit?

590


how to include numeric values in sql statements? : Sql dba

555


How long it takes to learn pl sql?

530


What is the usage of distinct keyword?

626


What is t-sql? : Transact sql

536


How does a covering index work?

523