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 / 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 |
Post New Answer View All Answers
What is write ahead logging in sql server?
What is db journal file?
What is a sql*loader control file?
how to drop an existing index in mysql? : Sql dba
what is a primary key? : Sql dba
What is trigger and how to use it in sql?
What is the unique index?
When do we use triggers?
Explain the types of joins in sql?
Does user triggers have entry for trigger with compilation errors?
What is cte?
How does left join work in sql?
what are the different functions in sorting an array? : Sql dba
Which sql statement is used to delete data from a database?
First round ------------------- - Procedure - Packages - Views - Virtual tables - Can we use dcl with in function? - Joins and few scenarios - Triggers and its type - Pragma, type and its functionality - How to create db link in oracle - Materialized view - How to find duplicate values from table? - Cursor and its functionality - Write a script to display friday and its date from a entire year. - Exception Handling Second round ------------------------ Gave a scenario like. Need to write a function to perform. When user try to change a password. It must not be last five password and a given password can be combination of characters, symbols, upper and lower case.