What is a self join? Explain it with an example?
Answer Posted / anuj barthwal
A self join applies on one table only
Example:
emp_id emp_name emp_manager_id
1 Anuj NULL
2 Sunny 1
3 Suraj 1
4 Narban 2
if we want to get the name of the managers
select e1.emp_name 'manager',e2.emp_name 'employee'
from employees e1 join employees e2
on e1.emp_id=e2.emp_manager_id
manager employee
Anuj Sunny
Anuj Suraj
Sunny Narban
Self join means joining the single table to itself
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
Write short notes on manual refreshes.
Write the fastest query to find out how many rows exist in a table?
What are the main phases of database development?
How to customize error conditions.
Where is dbms used?
What is dbms explain in brief?
How to combine two function together?
Explain about the storage and physical database design?
What is an application role and explain a scenario when you would use one?
I HAVE A PI ON COL A THE NEXT DAY I WANT CHANGE THE PI ON COL B? PLS SEND ME THE ANS
Explain what a database is?
Which data type cannot be used as a parameter in a udf?
Hi , any one can help me on the same,this is regarding the Informatica Function doc,i want to know how developer is will develop the mapping. pl forwar the any function doc .just for my references. svlc75@yahoo.co.in
What is the maximum length of an extended property?
I have a few records all are same structures data, I want to store data in multiple targets how