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 use of self join and which cases you will use this join



what is use of self join and which cases you will use this join..

Answer / vidhya

A physical file can be joined to itself to read records that are formed by combining two or more records from the PF itself.
For example
You use a self join when a table references data in itself.

E.g., an Employee table may have a SupervisorID column that points to the employee that is the boss of the current employee.

To query the data and get information for both people in one row, you could self join like this:

select e1.EmployeeID,
e1.FirstName,
e1.LastName,
e1.SupervisorID,
e2.FirstName as SupervisorFirstName,
e2.LastName as SupervisorLastName
from Employee e1
left outer join Employee e2 on e1.SupervisorID = e2.EmployeeID

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB400 Interview Questions

what is use of self join and which cases you will use this join

1 Answers   TCS,


what is the intractive job? what is the batch job ? how to change the batch job to interactive job?

2 Answers   Four soft,


what is dynslt and why we use that command when do we use command

2 Answers   Active Brains, UHG,


How many libraries can be there in a library list?

2 Answers  


Is it possible to create a logical file whose Physical file is not in same library?

6 Answers  


Is Constent can be define as a key field?

3 Answers  


In a CL Program after executing a SQL SP how to receive a Output value from the SP. Just to make it clear I am sending 2 input and 1 output parameter to the SQL Stored Procedure. Now while receiving it output parm it is failing.

0 Answers   Nous,


What is the difference between access path and open data path?

0 Answers  


Why journalling is compulsory before commitment control?

1 Answers  


How many max. Record format a logical file have?

13 Answers   Systime,


How to add a field to a PF and compile it without loss of data?

7 Answers  


what is the difference between adding keys & constraints into a phisical file

4 Answers   HSBC,


Categories