Search code examples
relational-algebra

how exactly does LEFT OUTER JOIN in relational algebra work when there is no common attribute?


for example suppose we have the two relations

R1(A,B) R2(C,D)

also these are the tables

  A B
 a1 b1 
 a2 b2

 C  D
 c1 d1
 c2 d2

will the left outer join result be the following table?

  A   B  C  D 
  a1 b1 c1 d1
  a1 b1 c2 d2
  a2 b2 c1 d1
  a2 b2 c2 d2

we have no common attributes and this is why I don't include any NULL.

if this result is correct then it's essentially the same with the simple join and the cross join operator am I wrong?


Solution

  • LEFT OUTER JOIN is always done on some common column. For your example CROSS JOIN is the only one applicable - and it will give you exactly the result you provided.

    Excrept (Chapter 5, Relational Algebra) from Rebeca M. Riordan: Designing Relational Database Systems, published by Microsoft Press:

    An outer join returns all the records returned by an inner join, plus all the records from either or both of the other recordsets. The missing ("unmatched") values will be Null.