Define Join and explain different type of joins?

In order to avoid data duplication, data is stored in related tables . Join keyword is used to fetch data from related table. Join return rows when there is at least one match in both tables . Type of joins are

Outer Join : 
1. Right Join
Return all rows from the right table, even if there are no matches in the left table .
2. Left Join
Return all rows from the left table, even if there are no matches in the right table .
3. Full Join
Return rows when there is a match in one of the tables .

Self-Join

Self-join is query used to join a table to itself. Aliases should be used for the same table comparison

Cross Join 

Cross Join will return all records where each row from the first table is combined with each row from the second table.

Inner Join 

 

Leave a Comment

Your email address will not be published. Required fields are marked *