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

how to update physical files using normal logical file

4 Answers  


hi iam very new to as400. i had created one physical file can any one tell command to enter data in to that

9 Answers   Encore,


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

1 Answers   TCS,


How many maximum record format a logical file have?

0 Answers  


Hi, Please give the answer to this question? I have Phisical file with 100 records,there is no any duplicate records in this pf.Based on this pf one Logical file i have used.But this lf is viewing only 80 records only of that pf?What is the reason for this?Please give me answer?

4 Answers   IBM,






What is FORMAT keyword and its use?

0 Answers  


Q.1 how to implement the commitment control. 2.how to control commitment control from external program.

7 Answers   IBM,


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

6 Answers  


can any one tell me what is meant by PSSR? Kindly elaborate it...

1 Answers  


How to update physical file using logical file with example?

0 Answers  


Where the QTEMP library will get created? if the the answer is QSYS, then howcome more than one job can create same library name(QTEMP) in QSYS? what is the uniqueness of QTEMP? For example, run the below command in different workstation WRKOBJ QSYS/QTEMP And take 8 in the option to check the description. both will have different info. so where(which LIB) exactly the QTEMP is stored?

2 Answers  


I have physical file with 100 records,there is no any duplicate records in this pf.based on this pf one logical file I have used.but this lf is viewing only 80 records only of that pf?what is the reason for this?

0 Answers  


Categories