You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by ch...@apache.org on 2009/10/02 23:34:48 UTC

svn commit: r821180 - in /db/derby/docs/trunk/src/ref: refderby.ditamap rrefkeywords29722.dita rrefsqlj29840.dita rrefsqljcrossjoin.dita

Author: chaase3
Date: Fri Oct  2 21:34:48 2009
New Revision: 821180

URL: http://svn.apache.org/viewvc?rev=821180&view=rev
Log:
DERBY-4374: Document the CROSS JOIN operation in the reference manual

Added new topic, edited two others.

Patch: DERBY-4374-3.diff

Added:
    db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita   (with props)
Modified:
    db/derby/docs/trunk/src/ref/refderby.ditamap
    db/derby/docs/trunk/src/ref/rrefkeywords29722.dita
    db/derby/docs/trunk/src/ref/rrefsqlj29840.dita

Modified: db/derby/docs/trunk/src/ref/refderby.ditamap
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/refderby.ditamap?rev=821180&r1=821179&r2=821180&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/refderby.ditamap (original)
+++ db/derby/docs/trunk/src/ref/refderby.ditamap Fri Oct  2 21:34:48 2009
@@ -249,6 +249,8 @@
 </topicref>
 <topicref href="rrefsqlj57522.dita" navtitle="RIGHT OUTER JOIN operation">
 </topicref>
+<topicref href="rrefsqljcrossjoin.dita" navtitle="CROSS JOIN operation">
+</topicref>
 </topicref>
 <topicref href="rrefqueries.dita" navtitle="SQL queries">
 <topicref href="rrefsqlj21571.dita" navtitle="Query"></topicref>

Modified: db/derby/docs/trunk/src/ref/rrefkeywords29722.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefkeywords29722.dita?rev=821180&r1=821179&r2=821180&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefkeywords29722.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefkeywords29722.dita Fri Oct  2 21:34:48 2009
@@ -72,6 +72,7 @@
 <sli>CONVERT</sli>
 <sli>CORRESPONDING</sli>
 <sli>CREATE</sli>
+<sli>CROSS</sli>
 <sli>CURRENT</sli>
 <sli>CURRENT_DATE</sli>
 <sli>CURRENT_ROLE</sli>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj29840.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj29840.dita?rev=821180&r1=821179&r2=821180&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj29840.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj29840.dita Fri Oct  2 21:34:48 2009
@@ -30,16 +30,19 @@
 tables using an explicit equality test in a WHERE clause, such as "WHERE t1.col1
 = t2.col2".)</p></section>
 <refsyn><title>Syntax</title> <codeblock><b><i>JOIN Operation</i></b></codeblock> <p>The
-JOIN operations are:   <ul>
+JOIN operations are:</p>  <ul>
 <li><xref href="rrefsqlj35034.dita#rrefsqlj35034"></xref>   <p>Specifies a
-join between two tables with an explicit join clause. See <xref href="rrefsqlj35034.dita#rrefsqlj35034"></xref>.</p></li>
+join between two tables with an explicit join clause.</p></li>
 <li><xref href="rrefsqlj18922.dita#rrefsqlj18922"></xref>   <p>Specifies a
 join between two tables with an explicit join clause, preserving unmatched
-rows from the first table. See <xref href="rrefsqlj18922.dita#rrefsqlj18922"></xref>.</p></li>
+rows from the first table.</p></li>
 <li><xref href="rrefsqlj57522.dita#rrefsqlj57522"></xref>   <p>Specifies a
 join between two tables with an explicit join clause, preserving unmatched
-rows from the second table. See <xref href="rrefsqlj57522.dita#rrefsqlj57522"></xref>.</p></li>
-</ul></p> <p>In all cases, you can specify additional restrictions on one
+rows from the second table.</p></li>
+<li><xref href="rrefsqljcrossjoin.dita#rrefsqljcrossjoin"></xref> <p> Specifies a
+join that produces the Cartesian product of two tables. It has no explicit join
+clause.</p></li>
+</ul> <p>In all cases, you can specify additional restrictions on one
 or both of the tables being joined in outer join clauses or in the <xref href="rrefsqlj33602.dita#rrefsqlj33602">WHERE
 clause</xref>.</p> </refsyn>
 <section><title>JOIN expressions and query optimization</title> <p>For information

Added: db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita?rev=821180&view=auto
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita (added)
+++ db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita Fri Oct  2 21:34:48 2009
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at      
+
+http://www.apache.org/licenses/LICENSE-2.0  
+
+Unless required by applicable law or agreed to in writing, software  
+distributed under the License is distributed on an "AS IS" BASIS,  
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
+See the License for the specific language governing permissions and  
+limitations under the License.
+-->
+
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
+<reference id="rrefsqljcrossjoin" xml:lang="en-us">
+<title>CROSS JOIN operation</title>
+<prolog><metadata>
+<keywords><indexterm>CROSS JOIN operation</indexterm></keywords>
+</metadata></prolog>
+<refbody>
+<section><p>A CROSS JOIN is a
+<xref href="rrefsqlj29840.dita#rrefsqlj29840">JOIN operation</xref> that
+produces the Cartesian product of two tables. Unlike other JOIN operators, it
+does not let you specify a join clause. You may, however, specify a WHERE clause
+in the SELECT statement.</p></section>
+<refsyn><title>Syntax</title>
+<codeblock><b><i><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i> CROSS JOIN { <xref href="rrefsqlj33215.dita#rrefsqlj33215">TableViewOrFunctionExpression</xref> | ( <i><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i> ) }</b></codeblock>
+</refsyn>
+<example><title>Examples</title>
+<p>The following SELECT statements are equivalent:</p>
+<codeblock><b>SELECT * FROM CITIES CROSS JOIN FLIGHTS</b></codeblock>
+<codeblock><b>SELECT * FROM CITIES, FLIGHTS</b></codeblock>
+<p>The following SELECT statements are equivalent:</p>
+<codeblock><b>SELECT * FROM CITIES CROSS JOIN FLIGHTS
+    WHERE CITIES.AIRPORT = FLIGHTS.ORIG_AIRPORT</b></codeblock>
+<codeblock><b>SELECT * FROM CITIES INNER JOIN FLIGHTS
+    ON CITIES.AIRPORT = FLIGHTS.ORIG_AIRPORT</b></codeblock>
+<p>The following example is more complex. The ON clause in this example is
+associated with the LEFT OUTER JOIN operation. Note that you can use parentheses
+around a JOIN operation.</p>
+<codeblock><b>SELECT * FROM CITIES LEFT OUTER JOIN
+    (FLIGHTS CROSS JOIN COUNTRIES)
+        ON CITIES.AIRPORT = FLIGHTS.ORIG_AIRPORT
+            WHERE COUNTRIES.COUNTRY_ISO_CODE = 'US'</b></codeblock>
+<p>A CROSS JOIN operation can be replaced with an INNER JOIN where the join
+clause always evaluates to true (for example, 1=1). It can also be replaced with
+a sub-query. So equivalent queries would be:</p>
+<codeblock><b>SELECT * FROM CITIES LEFT OUTER JOIN
+    FLIGHTS INNER JOIN COUNTRIES ON 1=1
+        ON CITIES.AIRPORT = FLIGHTS.ORIG_AIRPORT
+            WHERE COUNTRIES.COUNTRY_ISO_CODE = 'US'</b></codeblock>
+<codeblock><b>SELECT * FROM CITIES LEFT OUTER JOIN
+    (SELECT * FROM FLIGHTS, COUNTRIES) S
+        ON CITIES.AIRPORT = S.ORIG_AIRPORT
+            WHERE S.COUNTRY_ISO_CODE = 'US'</b></codeblock>
+</example>
+</refbody>
+</reference>

Propchange: db/derby/docs/trunk/src/ref/rrefsqljcrossjoin.dita
------------------------------------------------------------------------------
    svn:eol-style = native