Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Joins


Join syntax of SQL allows you to connect two database tables which share a column value. On most occasions, the shared columns constitute foreign key relation between two tables but having such relationship is not mandatory. As long as the columns hold the value referring to the same record, you can run a meaningful join query. For instance, in our domain, the Employee table's Id column and the Benefit table's Employee_Id column hold the Id of particular employee record. We can join the two tables using value in those two columns.

Different types of joins

There are mainly two types of joins. An inner join and an outer join. The best way to understand the difference between the two is to use Venn diagram from set theory. If you think of employee as one set and benefit as another set, then intersection between the two can be represented by a Venn diagram as follows:

The overlapping area or intersection of the Employee and Benefit sets represents the records that are present in both sets...