[prev] 38 [next]

Relational Algebra Operations (cont)

Left Outer Join
  • JoinLO[C](R,S) includes entries for all R tuples
  • even if they have no matches with tuples in S under C
Computational description of r(R) LeftOuterJoin s(S):

result = {}
for each tuple t1 in relation r
   nmatches = 0
   for each tuple t2 in relation s
      if (matches(t1,t2,C))
         result = result ∪ {combine(t1,t2)}
         nmatches++
   if (nmatches == 0)
      result = result ∪ {combine(t1,Snull)}

where Snull is a tuple with schema S and all atributes set to NULL.