> bissa...@yahoo.co.uk wrote:
> > Hi,
[quoted text clipped - 23 lines]
> See UNION or LEFT OUTER JOIN. (Outer joins are just shorthands for
> unions but more people know outer joins than know unions for some reason.)
I was just wondering about this, and its jarring. I'm struggling to
even describe outer joins in terms of unions at all. F'rinstance, I
was mulling over the example:
R1 = { (a:1), (a:2) }
R2 = { (a:1, c:1) }
R1 OUTER JOIN R2 = { (a:1, c:1), (a:2, c:null) }
Its the null 'value' that's the problem - where the hell has it
appeared from? (a:2, b:null) wasn't a member of R1 so the union can't
have simply been from that. If the union was with R1 extended with
(c:null), well then the result of the outer join would also have (a:1,
c:null) in it, which clearly isn't the case either. And if in a union
we are automatically extending the unary tuples of R1 to be binary
tuples to match the 'header' with the largest cardinality, well thats
some change to the normal behaviour of set union. Outer joins...Ugh.
Bob Badour - 09 Mar 2008 22:34 GMT
>>bissa...@yahoo.co.uk wrote:
>>
[quoted text clipped - 35 lines]
> Its the null 'value' that's the problem - where the hell has it
> appeared from?
When one writes the union, the NULL or whatever else one uses is a literal.
R1 JOIN R2
UNION
EXTEND (R1 MINUS R2{a}) ADD c=NULL
(a:2, b:null) wasn't a member of R1 so the union can't
> have simply been from that. If the union was with R1 extended with
> (c:null), well then the result of the outer join would also have (a:1,
> c:null) in it, which clearly isn't the case either. And if in a union
> we are automatically extending the unary tuples of R1 to be binary
> tuples to match the 'header' with the largest cardinality, well thats
> some change to the normal behaviour of set union. Outer joins...Ugh.
Null...ugh.