| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: NATURAL JOIN without join columbs
You go Cartesian. Let me quote that part of SQL-92:
7.5 <joined table>
Function
Specify a table derived from a Cartesian product, inner or outer join, or union join.
Format
<joined table> ::=
<cross join>
| <qualified join>
| <left paren> <joined table> <right paren>
<cross join> ::=
<table reference> CROSS JOIN <table reference>
<qualified join> ::=
<table reference> [NATURAL] [<join type>] JOIN
<table reference> [<join specification>]
<join specification> ::=
<join condition>
| <named columns join>
<join condition> ::= ON <search condition>
<named columns join> ::=
USING <left paren> <join column list> <right paren>
<join type> ::=
INNER
| <outer join type> [OUTER]
| UNION
<outer join type> ::=
LEFT
| RIGHT
| FULL
<join column list> ::= <column name list>
Syntax Rules
SELECT * FROM TR1, TR2 2) If a <qualified join> is specified, then
Case:
Note: Outer reference is defined in Subclause 6.4, "<column reference>".
5) If neither NATURAL is specified nor a <join specification> simply containing a <named columns join> is specified, then the descriptors of the columns of the result of the <joined table> are the same as the descriptors of the columns of CP.
6) If NATURAL is specified or if a <join specification> simply containing a <named columns join> is specified, then:
COALESCE (TA.C, TB.C) AS C for every column C that is a corresponding join column, taken in order of their ordinal positions in T1.
e) Let SL1 be a <select list> of those <column name>s of T1 that are not corresponding join columns, taken in order of their ordinal positions in T1, and let SLT2 be a <select list> of those <column name>s of T2 that are not corresponding join columns, taken in order of their ordinal positions in T2.
f) The descriptors of the columns of the result of the <joined table> are the same as the descriptors of the columns of the result of
SELECT SLCC, SLT1, SLT2 FROM TR1, TR2 7) For every column CR of the result of the <joined table> that is not a corresponding join column and that corresponds to a column C1 of T1, CR is possibly nullable if any of the following conditions are true:
Access Rules
None.
General Rules
Case:
i) If there are corresponding join columns, then let T be the multiset of rows of CP for which the corresponding join columns have equal values.
ii) Otherwise, let T be the multiset of rows of CP.
2) Let P1 be the multiset of rows of T1 for which there exists in T some row that is the concatenation of some row R1 of T1 and some row R2 of T2. Let P2 be the multiset of rows of T2 for which there exists in T some row that is the concatenation of some row R1 of T1 and some row R2 of T2.
3) Let U1 be those rows of T1 that are not in P1 and let U2 be those rows of T2 that are not in P2.
4) Let D1 and D2 be the degree of T1 and T2, respectively. Let X1 be U1 extended on the right with D2 columns containing the null value. Let X2 be U2 extended on the left with D1 columns containing the null value.
5) Let XN1 and XN2 be effective distinct names for X1 and X2, respectively. Let TN be an effective name for T.
Case:
SELECT * FROM TN
UNION ALL
SELECT * FROM XN1
c) If RIGHT is specified, then let S be the multiset of rows resulting
from:
SELECT * FROM TN
UNION ALL
SELECT * FROM XN2
d) If FULL is specified then let S be the multiset of rows resulting
from:
..
Received on Mon Mar 14 2005 - 10:28:31 CST
![]() |
![]() |