Outer Joins
Types of Outer Joins
- Left Outer Joins
- Right Outer Joins
- Full Outer Joins
Left Outer Joins :
In case of Left Outer Joins data from left table is completely included into the result set , but only matched data from right side table is included into the result set. In place of right table data Null's are included where there is no match .
I.Create the two tables Persons and Profession
II.Display the tables with values
Resultant Set:
tblPersons tblProfession
Example of Left Outer Join Query :
Resultant Set:
Note: here by condition of left outer join , first table of Pid is compared with second table of P_id based on condition . Left Table data is completely included and right Table data will include on match condition ,remaining fields will be filled with Null's values.
Right Outer Join:
In case of Right Outer Join data from right table is completely included into the result set,but only matched data from left side table is include into the result set. In place of left table data Null's are included where there is no matched.
Example of Right Outer Join Query :
Resultant Set :
Note : Right Table data is completely included and Left Table data will include on match condition , remaining fields will be filled with Null's values.
Full Outer Join :
In case of Full Outer Join data from both the tables are included into the result set irrespective of condition Null's are included where ever there is no match.
Example of Full Outer Join Query :
Resultant Set :
Hope you all understand the Outer Join with simple example
Do have any query regarding my code you can comment below !!!
No comments:
Post a Comment