Oracle 5.0 Reference Manual page 1113

Table of Contents

Advertisement

If the join operation is any other join, the result columns of the join consists of the concatenation of all
columns of the joined tables. This is the same as previously.
A consequence of the definition of coalesced columns is that, for outer joins, the coalesced column
contains the value of the
both columns are NULL, both common columns have the same value, so it doesn't matter which one
is chosen as the value of the coalesced column. A simple way to interpret this is to consider that
a coalesced column of an outer join is represented by the common column of the inner table of a
JOIN. Suppose that the tables
t1
t2
----
----
1 x
2 z
2 y
3 w
Then:
mysql>
SELECT * FROM t1 NATURAL LEFT JOIN t2;
+------+------+------+
| a
| b
| c
+------+------+------+
|
1 | x
| NULL |
|
2 | y
| z
+------+------+------+
Here column
contains the values of t1.a.
a
mysql>
SELECT * FROM t1 NATURAL RIGHT JOIN t2;
+------+------+------+
| a
| c
| b
+------+------+------+
|
2 | z
| y
|
3 | w
| NULL |
+------+------+------+
Here column
contains the values of t2.a.
a
Compare these results to the otherwise equivalent queries with
mysql>
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a = t2.a);
+------+------+------+------+
| a
| b
| a
+------+------+------+------+
|
1 | x
| NULL | NULL |
|
2 | y
|
+------+------+------+------+
mysql>
SELECT * FROM t1 RIGHT JOIN t2 ON (t1.a = t2.a);
+------+------+------+------+
| a
| b
| a
+------+------+------+------+
|
2 | y
|
| NULL | NULL |
+------+------+------+------+
• Previously, a
USING
columns. For example, the following two clauses were semantically identical:
a LEFT JOIN b USING (c1,c2,c3)
a LEFT JOIN b ON a.c1=b.c1 AND a.c2=b.c2 AND a.c3=b.c3
Now the two clauses no longer are quite the same:
• With respect to determining which rows satisfy the join condition, both joins remain semantically
identical.
SELECT
non-NULL
column if one of the two columns is always NULL. If neither or
and
t1(a,b)
|
|
|
|
| c
|
2 | z
|
| c
|
2 | z
|
3 | w
|
clause could be rewritten as an
1093
Syntax
have the following contents:
t2(a,c)
JOIN ...
clause that compares corresponding
ON
ON:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents