Database Tutorial

Course Tutorial Site

Site Admin

Cross Join

without comments

The principal join is a CROSS JOIN, which matches every row in one table against every row in another. This is an unfiltered join. The other join types start with this concept and filter the result set.

Another way to describe an CROSS JOIN is as a Cartesian Product, which is a combination of two sets where each row in one is matched to each row in another. The formula multiplies the sets, which means every ordered pair of (x,y) is unique. Each element x is an element (∈) in set A, and (∧) each element y is an element (∈) in set B. The ordered result set of (x,y) is not equal to the ordered result set of (y,x).

The CROSS JOIN may contain an intersection of rows because the ordered pair of (x,y) is the ordered pair of rows from the table on the left, or A, and they are matched against the rows from the table on the right, or B. Those elements (rows) in A that share an attribute (column) value with an attribute (column) value in an element (or row) from B become the intersection of a join. The intersection is also known as the INNER JOIN of the tables.

Written by michaelmclaughlin

January 17th, 2010 at 10:25 pm

Posted in

Leave a Reply