Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

230


Part II: Building Databases and Working with Data


FIGURE 9-7
A graphical representation of a cross join is simply two tables without a join condition.

The result of a join without restriction is that every row in table Customer2 matches with
every row from table SalesOrder2:

CustomerID LastName OrderNumber
----------- ------------------ ---------------
101 Smith 1
102 Adams 1
103 Reagan 1
101 Smith 2
102 Adams 2
103 Reagan 2
101 Smith 3
102 Adams 3
103 Reagan 3

Exotic Joins
Nearly all joins are based on a condition of equality between the primary key of a primary
table and the foreign key of a secondary table, which is why the inner join is sometimes
called an equi-join. Although it’s commonplace to base a join on a single equal condition, it

c09.indd 230c09.indd 230 7/30/2012 4:25:08 PM7/30/2012 4:25:08 PM


http://www.it-ebooks.info
Free download pdf