db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r937958 - in /db/derby/docs/trunk/src/ref: refderby.ditamap rrefsqlj18922.dita rrefsqlj35034.dita rrefsqlj57522.dita rrefsqljusing.dita
Date Mon, 26 Apr 2010 08:10:11 GMT
Author: kahatlen
Date: Mon Apr 26 08:10:10 2010
New Revision: 937958

URL: http://svn.apache.org/viewvc?rev=937958&view=rev
Log:
DERBY-4401: Document USING clause in joins

Added:
    db/derby/docs/trunk/src/ref/rrefsqljusing.dita   (with props)
Modified:
    db/derby/docs/trunk/src/ref/refderby.ditamap
    db/derby/docs/trunk/src/ref/rrefsqlj18922.dita
    db/derby/docs/trunk/src/ref/rrefsqlj35034.dita
    db/derby/docs/trunk/src/ref/rrefsqlj57522.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=937958&r1=937957&r2=937958&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/refderby.ditamap (original)
+++ db/derby/docs/trunk/src/ref/refderby.ditamap Mon Apr 26 08:10:10 2010
@@ -229,6 +229,7 @@ limitations under the License.
 <topicref href="rrefsqlj14854.dita" navtitle="HAVING clause"></topicref>
 <topicref href="rrefsqlj13658.dita" navtitle="ORDER BY clause"></topicref>
 <topicref href="rrefsqljoffsetfetch.dita" navtitle="The result offset and fetch first
clauses"></topicref>
+<topicref href="rrefsqljusing.dita" navtitle="USING clause"/>
 <topicref href="rrefsqlj33602.dita" navtitle="WHERE clause"></topicref>
 <topicref href="rrefsqlj15309.dita" navtitle="WHERE CURRENT OF clause"></topicref>
 </topicref>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj18922.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj18922.dita?rev=937958&r1=937957&r2=937958&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj18922.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj18922.dita Mon Apr 26 08:10:10 2010
@@ -30,8 +30,11 @@ the shape of the second (right) table.</
 <refsyn><title>Syntax</title><codeblock><b><i><xref
href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
LEFT [ OUTER ] JOIN <i
 ><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
 {
-    ON <i>booleanExpression</i> 
-    }</b></codeblock><p>The scope of expressions in either the ON clause
includes
+    ON <i>booleanExpression</i> |
+    <i><xref href="rrefsqljusing.dita#rrefsqljusing">USING clause</xref></i>
+}</b></codeblock>
+
+<p>The scope of expressions in either the ON clause includes
 the current tables and any tables in query blocks outer to the current SELECT.
  The ON clause can reference tables not being joined and does not have to
 reference either of the tables being joined (though typically it does).</p> </refsyn>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj35034.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj35034.dita?rev=937958&r1=937957&r2=937958&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj35034.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj35034.dita Mon Apr 26 08:10:10 2010
@@ -26,8 +26,11 @@ limitations under the License.
 <refbody>
 <section> <p>An INNER JOIN is a <xref href="rrefsqlj29840.dita#rrefsqlj29840">JOIN
operation</xref> that
 allows you to specify an explicit join clause. </p></section>
-<refsyn><title>Syntax</title> <codeblock><b><i><xref
href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
[ INNER ] JOIN <i
-><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
{ ON <i>booleanExpression</i> }</b></codeblock> <p>You can specify
the join clause by specifying ON
+<refsyn><title>Syntax</title>
+
+<codeblock><b><i><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
[ INNER ] JOIN <i><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
{ ON <i>booleanExpression</i> | <i><xref href="rrefsqljusing.dita#rrefsqljusing">USING
clause</xref></i> }</b></codeblock>
+
+<p>You can specify the join clause by specifying ON
 with a boolean expression.  </p> <p><indexterm>ON clause<indexterm>part
of
 INNER JOIN expression</indexterm></indexterm>The scope of expressions in the
 ON clause includes the current tables and any tables in outer query blocks

Modified: db/derby/docs/trunk/src/ref/rrefsqlj57522.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj57522.dita?rev=937958&r1=937957&r2=937958&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj57522.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj57522.dita Mon Apr 26 08:10:10 2010
@@ -31,8 +31,11 @@ B RIGHT OUTER JOIN A, with the columns i
 <refsyn><title>Syntax</title><codeblock><b><i><xref
href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
RIGHT [ OUTER ] JOIN <i
 ><xref href="rreftableexpression.dita#rreftableexpression">TableExpression</xref></i>
 {
-    ON <i>booleanExpression</i> 
-    }</b></codeblock><p>The scope of expressions in the ON clause includes
+    ON <i>booleanExpression</i> |
+    <i><xref href="rrefsqljusing.dita#rrefsqljusing">USING clause</xref></i>
+}</b></codeblock>
+
+<p>The scope of expressions in the ON clause includes
 the current tables and any tables in query blocks outer to the current SELECT.
  The ON clause can reference tables not being joined and does not have to
 reference either of the tables being joined (though typically it does).</p> </refsyn>

Added: db/derby/docs/trunk/src/ref/rrefsqljusing.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqljusing.dita?rev=937958&view=auto
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljusing.dita (added)
+++ db/derby/docs/trunk/src/ref/rrefsqljusing.dita Mon Apr 26 08:10:10 2010
@@ -0,0 +1,112 @@
+<?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="rrefsqljusing" xml:lang="en-us">
+
+<title>USING clause</title>
+
+<prolog>
+  <metadata>
+    <keywords>
+      <indexterm>USING clause</indexterm>
+    </keywords>
+  </metadata>
+</prolog>
+
+<refbody>
+
+<section>
+
+<p>
+The USING clause specifies which columns to test for equality when two
+tables are joined. It can be used instead of an ON clause in the
+<xref href="rrefsqlj29840.dita#rrefsqlj29840">JOIN operations</xref>
+that have an explicit join clause.
+</p>
+
+</section>
+
+<refsyn>
+<title>Syntax</title>
+
+<codeblock><b>USING ( <i><xref href="rrefsimplecolumnname.dita#rrefsimplecolumnname">Simple-column-Name</xref></i>
[ , <i><xref href="rrefsimplecolumnname.dita#rrefsimplecolumnname">Simple-column-Name</xref></i>
]* )</b></codeblock>
+
+<p>
+The columns listed in the USING clause must be present in both of the
+two tables being joined. The USING clause will be transformed to an ON
+clause that checks for equality between the named columns in the two
+tables.
+</p>
+
+<p>
+When a USING clause is specified, an asterisk (*) in the select list
+of the query will be expanded to the following list of columns (in
+this order):
+</p>
+
+<ul>
+<li>All the columns in the USING clause</li>
+<li>All the columns of the first (left) table that are not specified
+in the USING clause</li>
+<li>All the columns of the second (right) table that are not specified
+in the USING clause</li>
+</ul>
+
+<p>
+An asterisk qualified by a table name (for example, COUNTRIES.*) will
+be expanded to every column of that table that is not listed in the
+USING clause.
+</p>
+
+<p>
+If a column in the USING clause is referenced without being qualified
+by a table name, the column reference points to the column in the
+first (left) table if the join is an INNER JOIN or a LEFT OUTER
+JOIN. If it is a RIGHT OUTER JOIN, unqualified references to a column
+in the USING clause point to the column in the second (right) table.
+</p>
+
+</refsyn>
+
+<example>
+<title>Examples</title>
+
+<p>
+The following query performs an inner join between the COUNTRIES table
+and the CITIES table on the condition that COUNTRIES.COUNTRY is equal
+to CITIES.COUNTRY:
+</p>
+
+<codeblock><b>SELECT * FROM COUNTRIES JOIN CITIES
+     USING (COUNTRY)</b></codeblock>
+
+<p>
+The next query is similar to the one above, but it has the additional
+join condition that COUNTRIES.COUNTRY_ISO_CODE is equal to
+CITIES.COUNTRY_ISO_CODE:
+</p>
+
+<codeblock><b>SELECT * FROM COUNTRIES JOIN CITIES
+    USING (COUNTRY, COUNTRY_ISO_CODE)</b></codeblock>
+
+</example>
+
+</refbody>
+</reference>

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



Mime
View raw message