Many times we come across the situation where we need to fetch data from multiple tables based on some conditions. for example consider the below scenarios:
• Display all students with their Address.
• Display all employee with their Departments.
• Display all departments with Employee regardless it has any employee or it has no employee.
• Display all combination of Student and courses.
• Display all students based on their courses, group-wise.
Join simply means linking two collections based on some common attributes. In LINQ, as we query a collection, so, here joining operators are used to join two or more lists or collections based on a specified expression. In general there are 4 types of joins possible between two collections , those are
• INNER JOIN
• LEFT OUTER JOIN
• CROSS JOIN
• GROUP JOIN
In Linq we have only two Join Operators
1. Join
2. GroupJoin
But we can achieve all the four types of joins mentioned above, just using these two join operators. In our coming chapters, we will discuss each of these Join operators in detail with examples.