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

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


Please Help Members By Posting Answers For Below Questions

What are the key features of dbms?

987


How can you fix a poorly performing query?

1172


What are the types of database model?

1080


What is a database development?

959


What are the constraints on severity level in raiseerror?

980


On friday, you issued several insert statements using query analyzer. You then verified the data had been correctly entered with a select statement on monday, your users report that the data is not there what happened?

995


How to use online Backups?

2196


What you can do to remove data from the cache and query plans from memory for testing the performance of a query repeatedly?

1008


Explain about xml databases?

1060


Can an extended stored procedure be called from inside a user-defined function?

1049


What is the physical representation for a many-to-many relationship?

1071


Explain the cube operator?

997


Write the fastest query to find out how many rows exist in a table?

1109


Explain about network model?

999


When installing the datastage7.5x2 edtion iam getting aproblem i.e the cpu count is 2 but the cpu count in installation is one . how can i install in my p.c (system is dual core).

2207