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

Define implicit and explicit cursors.

629


What action do you have to perform before retrieving data from the next result set of a stored procedure ?

2095


What is out parameter used for eventhough return statement can also be used in pl/sql?

586


Why do we use function in pl sql?

559


Why truncate is faster than delete?

565






Write a program that shows the usage of while loop to calculate the average of user entered numbers and entry of more numbers are stopped by entering number 0?

1683


What is Collation Sensitivity ? What are the various type ?

501


Explain constraints in sql?

574


Explain lock escalation? : Transact sql

705


how to present a past time in hours, minutes and seconds? : Sql dba

563


What is a field in a database?

568


Is mariadb a nosql database?

542


What is mutating error in pl sql?

553


what is sp_pkeys? : Transact sql

699


What is difference between stored procedures and application procedures?

572