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 sc...@apache.org on 2007/03/01 01:56:37 UTC

svn commit: r513085 - in /db/derby/docs/trunk/src/ref: rrefsqlj13658.dita rrefsqlj19433.dita rrefsqlj23075.dita

Author: scotsmatrix
Date: Wed Feb 28 16:56:36 2007
New Revision: 513085

URL: http://svn.apache.org/viewvc?view=rev&rev=513085
Log:
DERBY-264: Updated several topics in the Reference Manual to document that expressions are allowed in ORDER BY clauses. Patch derby264_3.diff was contributed by me (Laura Stewart).

Modified:
    db/derby/docs/trunk/src/ref/rrefsqlj13658.dita
    db/derby/docs/trunk/src/ref/rrefsqlj19433.dita
    db/derby/docs/trunk/src/ref/rrefsqlj23075.dita

Modified: db/derby/docs/trunk/src/ref/rrefsqlj13658.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj13658.dita?view=diff&rev=513085&r1=513084&r2=513085
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj13658.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj13658.dita Wed Feb 28 16:56:36 2007
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
 <!-- 
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -15,45 +18,73 @@
 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 xml:lang="en-us" id="rrefsqlj13658">
+<reference id="rrefsqlj13658" xml:lang="en-us">
 <title>ORDER BY clause</title>
+<shortdesc>The ORDER BY clause is an optional element of a SELECT statement.
+An ORDER BY clause allows you to specify the order in which rows appear in
+the <varname>ResultSet</varname>.</shortdesc>
 <prolog><metadata>
-<keywords><indexterm>ORDER BY clause</indexterm>
+<keywords><indexterm>ORDER BY clause<indexterm>syntax</indexterm></indexterm>
+<indexterm>ASC<indexterm>implied in ORDER BY clause</indexterm></indexterm>
+<indexterm>DESC<indexterm>optional element of ORDER BY clause</indexterm></indexterm>
+<indexterm>ORDER BY clause<indexterm>affecting cursors</indexterm></indexterm>
+<indexterm>ORDER BY clause<indexterm>specifying expressions</indexterm></indexterm>
 </keywords>
-</metadata>
-</prolog><refbody>
-<section>
-<p>The ORDER BY clause is an optional element of a <xref href="rrefsqlj41360.dita#rrefsqlj41360"/>. An ORDER BY clause allows you to specify the order in which
-rows appear in the <i>ResultSet</i>.</p></section>
-<refsyn><title>Syntax</title>
-<codeblock><b>ORDER BY { <i><xref href="rrefcolumnname.dita#rrefcolumnname"/></i> | <i>ColumnPosition</i> }
+</metadata></prolog>
+<refbody>
+<refsyn><title>Syntax</title><codeblock><b>ORDER BY { <i><xref href="rrefcolumnname.dita#rrefcolumnname"></xref></i> | <i>ColumnPosition</i> | <i
+>Expression</i> }
     [ ASC | DESC ]
-    [ , <i><xref href="rrefcolumnname.dita#rrefcolumnname"/></i> | <i>ColumnPosition</i>
-        [ ASC | DESC ] ] * </b></codeblock>
-<p><i>ColumnPosition</i> is an integer that identifies the
-number of the column in the <ph>SelectItem</ph> in the underlying Query of
-the <xref href="rrefsqlj41360.dita#rrefsqlj41360"/>. <i>ColumnPosition</i> must be greater than 0 and not greater than the number of columns in
-the result table. In other words, if you want to order by a column, that column
-must be in the select list.</p>
-<p><i><xref href="rrefcolumnname.dita#rrefcolumnname"/></i> refers to
-the names visible from the <i>SelectItems</i> in the underlying
-query of the <xref href="rrefsqlj41360.dita#rrefsqlj41360"/>. An order by column does
-not need to be in the select list.</p>
-<p><indexterm>ASC<indexterm>implied in ORDER BY clause</indexterm></indexterm><indexterm>DESC<indexterm>optional element of ORDER
-BY clause</indexterm></indexterm>ASC specifies that the results should be returned
-in ascending order; DESC specifies that the results should be returned in
-descending order. If the order is not specified, ASC is the default.</p>
-<p><indexterm>ORDER BY clause<indexterm>affecting cursors</indexterm></indexterm>An ORDER BY clause prevents a SELECT statement from being an updatable
-cursor. (For more information, see <xref href="rrefsqlj41360.dita#rrefsqlj41360/sqlj15384"/>.)</p>
-<p>For example, if an INTEGER column contains integers, NULL is considered
-greater than 1 for purposes of sorting. In other words, NULL values are sorted
-high.</p>
-</refsyn>
-<example>
-<codeblock><b>-- order by the correlation name NATION
-SELECT CITY_NAME, COUNTRY AS NATION 
-FROM CITIES 
-ORDER BY NATION
-</b></codeblock>
-</example></refbody></reference>
+    [ , <i><xref href="rrefcolumnname.dita#rrefcolumnname"></xref></i> | <i>ColumnPosition</i> | <i>Expression</i> 
+        [ ASC | DESC ] ] * </b></codeblock><dl><dlentry>
+<dt>column-Name</dt>
+<dd>Refers to the names visible from the <varname>SelectItems</varname> in
+the underlying query of the <xref href="rrefsqlj41360.dita#rrefsqlj41360"></xref>.
+The column-Name that you specify in the ORDER BY clause does not need to be
+the SELECT list.</dd>
+</dlentry><dlentry>
+<dt>ColumnPosition</dt>
+<dd>An integer that identifies the number of the column in the <varname>SelectItems</varname> in
+the underlying query of the <xref href="rrefsqlj41360.dita#rrefsqlj41360"></xref>. <parmname>ColumnPosition</parmname> must
+be greater than 0 and not greater than the number of columns in the result
+table. In other words, if you want to order by a column, that column must
+be specified in the SELECT list.</dd>
+</dlentry><dlentry>
+<dt>Expression</dt>
+<dd>A sort key expression, such as numeric, string, and datetime expressions. <i>Expression</i> can
+also be a row value expression such as a scalar subquery or case expression.
+ </dd>
+</dlentry><dlentry>
+<dt>ASC</dt>
+<dd>Specifies that the results should be returned in ascending order. If the
+order is not specified, ASC is the default.</dd>
+</dlentry><dlentry>
+<dt>DESC</dt>
+<dd>Specifies that the results should be returned in descending order.</dd>
+</dlentry></dl> </refsyn>
+<section><title>Notes</title><ul>
+<li>If SELECT DISTINCT is specified or if the SELECT statement contains a
+GROUP BY clause, the ORDER BY columns must be in the SELECT list. </li>
+<li>An ORDER BY clause prevents a SELECT statement from being an updatable
+cursor. For more information, see <xref href="rrefsqlj41360.dita#rrefsqlj41360/sqlj15384"></xref>.
+For example, if an INTEGER column contains integers, NULL is considered greater
+than 1 for purposes of sorting. In other words, NULL values are sorted high.</li>
+</ul></section>
+<example><title>Example using a correlation name</title><p>You can sort the
+result set by a correlation name, if the correlation name is specified in
+the select list. For example, to return from the CITIES database all of the
+entries in the CITY_NAME and COUNTRY columns, where the COUNTRY column has
+the correlation name NATION, you specify this SELECT statement:</p><codeblock>SELECT CITY_NAME, COUNTRY AS NATION 
+    FROM CITIES 
+    ORDER BY NATION
+</codeblock> </example>
+<example><title>Example using a numeric expression</title><p>You can sort
+the result set by a numeric expression, for example:<codeblock>SELECT name, salary, bonus FROM employee 
+   ORDER BY salary+bonus</codeblock>In this example, the salary and bonus
+columns are DECIMAL data types.</p></example>
+<example><title>Example using a function</title><p>You can sort the result
+set by invoking a function, for example:<codeblock>SELECT i, len FROM measures 
+   ORDER BY sin(i) 
+</codeblock></p></example>
+</refbody>
+</reference>

Modified: db/derby/docs/trunk/src/ref/rrefsqlj19433.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj19433.dita?view=diff&rev=513085&r1=513084&r2=513085
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj19433.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj19433.dita Wed Feb 28 16:56:36 2007
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
 <!-- 
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -15,221 +18,250 @@
 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="rrefsqlj19433" xml:lang="en-us">
 <title>SQL expressions</title>
+<shortdesc>Syntax for many statements and expressions includes the term <term>Expression</term>,
+or a term for a specific kind of expression such as <varname>TableSubquery</varname>.
+Expressions are allowed in these specified places within statements. </shortdesc>
+<prolog><metadata>
+<keywords><indexterm>SQL expressions<indexterm>column reference</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>constant</indexterm></indexterm><indexterm>SQL
+expressions<indexterm>NULL</indexterm></indexterm><indexterm>SQL expressions<indexterm>dynamic
+parameter</indexterm></indexterm><indexterm>SQL expressions<indexterm>CAST</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>scalar subquery</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>table subquery</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>conditional</indexterm></indexterm><indexterm>SQL
+expressions<indexterm>numeric</indexterm></indexterm><indexterm>SQL expressions<indexterm>character</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>string with wildcards</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>concatenation function</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>CURRENT_DATE function</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>CURRENT_TIME function</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>CURRENT_TIMESTAMP function</indexterm></indexterm>
+<indexterm>SQL expressions<indexterm>mathematical (+ -, *, /, unary + and
+- )</indexterm></indexterm><indexterm>SQL expressions<indexterm>LENGTH function</indexterm></indexterm>
+<indexterm>expressions<indexterm>column reference</indexterm></indexterm>
+<indexterm>expressions<indexterm>constant</indexterm></indexterm><indexterm>expressions<indexterm>NULL</indexterm></indexterm>
+<indexterm>expressions<indexterm>dynamic parameter</indexterm></indexterm>
+<indexterm>expressions<indexterm>CAST</indexterm></indexterm><indexterm>expressions<indexterm>scalar
+subquery</indexterm></indexterm><indexterm>expressions<indexterm>table subquery</indexterm></indexterm>
+<indexterm>expressions<indexterm>conditional</indexterm></indexterm><indexterm>expressions<indexterm>numeric</indexterm></indexterm>
+<indexterm>expressions<indexterm>character</indexterm></indexterm><indexterm>expressions<indexterm>string
+with wildcards</indexterm></indexterm><indexterm>expressions<indexterm>concatenation
+function</indexterm></indexterm><indexterm>expressions<indexterm>CURRENT_DATE
+function</indexterm></indexterm><indexterm>expressions<indexterm>CURRENT_TIME
+function</indexterm></indexterm><indexterm>expressions<indexterm>CURRENT_TIMESTAMP
+function</indexterm></indexterm><indexterm>expressions<indexterm>mathematical
+(+ -, *, /, unary + and - )</indexterm></indexterm><indexterm>expressions<indexterm>LENGTH
+function</indexterm></indexterm></keywords>
+</metadata></prolog>
 <refbody>
-<section><p>Syntax for many statements and expressions includes the term <i>Expression</i>,
-or a term for a specific kind of expression such as <i>TableSubquery</i>.
-Expressions are allowed in these specified places within statements. Some
-locations allow only a specific type of expression or one with a specific
-property. <xref href="rrefsqlj19433.dita#rrefsqlj19433/sqlj18370"></xref>, lists all the possible
-SQL expressions and indicates where they are allowed.</p></section>
-<section><p>If not otherwise specified, an expression is permitted anywhere
-the word <i>Expression</i> appears in the syntax. This includes:   <ul>
+<section><p>Some locations allow only a specific type of expression or one
+with a specific property. If not otherwise specified, an expression is permitted
+anywhere the word <i>Expression</i> appears in the syntax. This includes:
+  <ul>
+<li><xref href="rrefsqlj13658.dita#rrefsqlj13658">ORDER BY clause</xref></li>
 <li><i><xref href="rrefselectexpression.dita#rrefselectexpression">SelectExpression</xref></i></li>
-<li><xref href="rrefsqlj26498.dita#rrefsqlj26498">UPDATE statement</xref> (SET portion)</li>
+<li><xref href="rrefsqlj26498.dita#rrefsqlj26498">UPDATE statement</xref> (SET
+portion)</li>
 <li><xref href="rrefsqlj11277.dita#rrefsqlj11277">VALUES Expression</xref></li>
 <li><xref href="rrefsqlj33602.dita#rrefsqlj33602">WHERE clause</xref></li>
-</ul></p></section>
-<section><p>Of course, many other statements include these elements as building
-blocks, and so allow expressions as part of these elements.   <table frame="all"
-id="sqlj18370"><title>Table of Expressions</title>
-<tgroup cols="3" colsep="1" rowsep="1"><colspec colname="1" colnum="1" colwidth="5*"/>
-<colspec colname="2" colnum="2" colwidth="43*"/><colspec colname="3" colnum="3"
-colwidth="52*"/>
+</ul></p><p>Of course, many other statements include these elements as building
+blocks, and so allow expressions as part of these elements. </p><p>The following
+tables list all the possible SQL expressions and indicate where the expressions
+are allowed.</p></section>
+<section><title>General expressions</title><p>General expressions are expressions
+that might result in a value of any type.<table frame="all" id="sqlj18370"
+pgwide="0"><title>Table of general expressions</title>
+<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="2" colnum="1" colwidth="300.00pt"/>
+<colspec colname="3" colnum="2" colwidth="600.00pt"/>
 <thead>
 <row>
-<entry colname="1"></entry>
 <entry align="left" colname="2" valign="bottom">Expression Type</entry>
 <entry align="left" colname="3" valign="bottom">Explanation</entry>
 </row>
 </thead>
 <tbody>
 <row>
-<entry nameend="2" namest="1"><i>General expressions</i></entry>
-<entry colname="3">All expressions that might result in a value of any type.</entry>
-</row>
-<row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Column reference expression</indexterm>Column
-reference</p>  <p>Allowed in <i><xref href="rrefselectexpression.dita#rrefselectexpression">SelectExpression</xref>s</i>,
-UPDATE statements, and the WHERE clauses of data manipulation statements.</p></entry>
-<entry colname="3">A <i><xref href="rrefcolumnname.dita#rrefcolumnname">column-Name</xref></i> that
+<entry colname="2"> Column reference  </entry>
+<entry colname="3">A <xref href="rrefcolumnname.dita#rrefcolumnname"><varname>column-Name</varname></xref> that
 references the value of the column made visible to the expression containing
-the Column reference.   <p>You must qualify the <i>column-Name</i> by the
-table name or correlation name if it is ambiguous.</p>  <p>The qualifier of
-a <i><xref href="rrefcolumnname.dita#rrefcolumnname">column-Name</xref></i> must be the
-correlation name, if a correlation name is given to a table that is in a <xref
-href="rrefsqlj21583.dita#rrefsqlj21583">FROM clause</xref>. The table name is no longer visible
-as a <i>column-Name</i> qualifier once it has been aliased by a correlation
-name.</p></entry>
+the Column reference.   <p>You must qualify the <varname>column-Name</varname> by
+the table name or correlation name if it is ambiguous.</p>  <p>The qualifier
+of a <varname>column-Name</varname> must be the correlation name, if a correlation
+name is given to a table that is in a <xref href="rrefsqlj21583.dita#rrefsqlj21583">FROM
+clause</xref>. The table name is no longer visible as a <i>column-Name</i> qualifier
+once it has been aliased by a correlation name.</p><p>Allowed in <i><xref
+href="rrefselectexpression.dita#rrefselectexpression">SelectExpression</xref>s</i>,
+UPDATE statements, and the WHERE clauses of data manipulation statements.</p></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Constant expression</indexterm>Constant</p></entry>
+<entry colname="2"> Constant</entry>
 <entry colname="3">Most built-in data types typically have constants associated
 with them (as shown in <xref href="crefsqlj31068.dita#crefsqlj31068"></xref>). </entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>NULL expression</indexterm>NULL</p>  <p>Allowed
+<entry colname="2"> NULL  </entry>
+<entry colname="3">NULL is an untyped constant representing the unknown value.<p>Allowed
 in CAST expressions or in INSERT VALUES lists and UPDATE SET clauses. Using
 it in a CAST expression gives it a specific data type.</p></entry>
-<entry colname="3">NULL is an untyped constant representing the unknown value.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Dynamic parameter expression</indexterm>Dynamic
-parameter</p>  <p>Allowed anywhere in an expression where the data type can
-be easily deduced. See <xref href="crefsqlj29911.dita#crefsqlj29911"></xref>.</p></entry>
+<entry colname="2"> Dynamic parameter  </entry>
 <entry colname="3">A dynamic parameter is a parameter to an SQL statement
 for which the value is not specified when the statement is created. Instead,
 the statement has a question mark (?) as a placeholder for each dynamic parameter.
 See <xref href="crefsqlj29911.dita#crefsqlj29911"></xref>.   <p>Dynamic parameters
 are permitted only in prepared statements. You must specify values for them
 before the prepared statement is executed. The values specified must match
-the types expected.</p></entry>
+the types expected.</p><p>Allowed anywhere in an expression where the data
+type can be easily deduced. See <xref href="crefsqlj29911.dita#crefsqlj29911"></xref>.</p></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>CAST expression</indexterm>CAST expression</p></entry>
+<entry colname="2"> CAST expression</entry>
 <entry colname="3">Lets you specify the type of NULL or of a dynamic parameter
 or convert a value to another type. See <xref href="rrefsqlj33562.dita#rrefsqlj33562"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Scalar subquery expression</indexterm>scalar
-subquery</p></entry>
+<entry colname="2">Scalar subquery</entry>
 <entry colname="3">Subquery that returns a single row with a single column.
 See <i><xref href="rrefscalarsubquery.dita#rrefscalarsubquery"></xref>.</i></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Table subquery expression</indexterm>table
-subquery</p> <p>Allowed as a tableExpression in a FROM clause and with EXISTS,
-IN, and quantified comparisons.</p></entry>
+<entry colname="2"> Table subquery </entry>
 <entry colname="3">Subquery that returns more than one column and more than
-one row. See <i><xref href="rreftablesubquery.dita#rreftablesubquery">TableSubquery</xref>.</i></entry>
+one row. See <i><xref href="rreftablesubquery.dita#rreftablesubquery">TableSubquery</xref>.</i><p>Allowed
+as a tableExpression in a FROM clause and with EXISTS, IN, and quantified
+comparisons.</p></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Conditional expression</indexterm>Conditional
-expression</p></entry>
+<entry colname="2"> Conditional expression</entry>
 <entry colname="3">A conditional expression chooses an expression to evaluate
 based on a boolean test.</entry>
 </row>
+</tbody>
+</tgroup>
+</table></p></section>
+<section><title>Boolean expressions</title><p>Boolean expressions are expressions
+that result in boolean values. Most general expressions can result in boolean
+values. Boolean expressions commonly used in a WHERE clause are made of operands
+operated on by SQL operators. See <xref href="rrefsqlj23075.dita#rrefsqlj23075/sqlj34517"></xref>.</p></section>
+<section><title>Numeric expressions</title><p>Numeric expressions are expressions
+that result in numeric values. Most of the general expressions can result
+in numeric values. Numeric values have one of the following types: <ul>
+<li>BIGINT</li>
+<li>DECIMAL</li>
+<li>DOUBLE PRECISION</li>
+<li>INTEGER</li>
+<li>REAL</li>
+<li>SMALLINT</li>
+</ul><table frame="all" pgwide="0"><title>Table of numeric expressions</title>
+<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="2" colnum="1" colwidth="400.00pt"/>
+<colspec colname="3" colnum="2" colwidth="600.00pt"/>
+<thead>
 <row>
-<entry nameend="2" namest="1"><i>Boolean expressions</i></entry>
-<entry colname="3">Expressions that result in boolean values. Most general
-expressions can result in boolean values.   <p>Boolean expressions commonly
-used in a WHERE clause are made of operands operated on by SQL operators.
-See <xref href="rrefsqlj23075.dita#rrefsqlj23075/sqlj34517"></xref>.</p></entry>
-</row>
-<row>
-<entry nameend="2" namest="1"><i><ph><indexterm>Numeric expressions</indexterm></ph>Numeric
-expressions</i></entry>
-<entry colname="3">Expressions that result in numeric values. Most of the
-general expressions can result in numeric values.   <p>Numeric values have
-one of the following types:</p>  <p>SMALLINT, INTEGER, BIGINT, REAL, DOUBLE
-PRECISION, DECIMAL.</p></entry>
-</row>
-<row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>+ -, *, /, unary + and - expressions</indexterm>+,
--, *, /, unary + and - expressions</p></entry>
-<entry colname="3">+, -, *, /, unary + and -   <p>Evaluate the expected math
-operation on the operands. If both operands are the same type, the result
-type is not promoted, so the division operator on integers results in an integer
-that is the truncation of the actual numeric result. When types are mixed,
-they are promoted as described in <xref href="crefsqlj31068.dita#crefsqlj31068"></xref>.</p>  <p>Unary
-+ is a noop (i.e., +4 is the same as 4). Unary - is the same as multiplying
-the value by -1, effectively changing its sign.</p></entry>
+<entry align="left" colname="2" valign="bottom">Expression Type</entry>
+<entry align="left" colname="3" valign="bottom">Explanation</entry>
 </row>
+</thead>
+<tbody>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>AVG</p></entry>
+<entry colname="2"> +, -, *, /, unary + and - expressions</entry>
+<entry colname="3">Evaluate the expected math operation on the operands. If
+both operands are the same type, the result type is not promoted, so the division
+operator on integers results in an integer that is the truncation of the actual
+numeric result. When types are mixed, they are promoted as described in <xref
+href="crefsqlj31068.dita#crefsqlj31068"></xref>.  <p>Unary + is a noop (i.e.,
++4 is the same as 4). Unary - is the same as multiplying the value by -1,
+effectively changing its sign.</p></entry>
+</row>
+<row>
+<entry colname="2"> AVG</entry>
 <entry colname="3">Returns the average of a set of numeric values. <xref href="rrefsqlj32693.dita#rrefsqlj32693"></xref></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>SUM</p></entry>
+<entry colname="2"> SUM</entry>
 <entry colname="3">Returns the sum of a set of numeric values. <xref href="rrefsqlj13083.dita#rrefsqlj13083"></xref></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>LENGTH function</indexterm>LENGTH</p></entry>
+<entry colname="2"> LENGTH</entry>
 <entry colname="3">Returns the number of characters in a character or bit
 string. See <xref href="rrefsqlj16762.dita#rrefsqlj16762"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>LOWER</p></entry>
+<entry colname="2"> LOWER</entry>
 <entry colname="3">See <xref href="rrefsqlj42049.dita#rrefsqlj42049"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>COUNT</p></entry>
+<entry colname="2"> COUNT</entry>
 <entry colname="3">Returns the count of a set of values. See <xref href="rrefsqlj38716.dita#rrefsqlj38716"></xref>, <xref
 href="rrefsqlj66113.dita#rrefsqlj66113"></xref>.</entry>
 </row>
+</tbody>
+</tgroup>
+</table></p></section>
+<section><title>Character expressions</title><p>Character expressions are
+expressions that result in a CHAR or VARCHAR value. Most general expressions
+can result in a CHAR or VARCHAR value.<table frame="all" pgwide="0"><title>Table
+of character expressions</title>
+<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="2" colnum="1" colwidth="400.00pt"/>
+<colspec colname="3" colnum="2" colwidth="600.00pt"/>
+<thead>
 <row>
-<entry nameend="2" namest="1"><i><ph><indexterm>Character expressions</indexterm></ph>Character
-expressions</i></entry>
-<entry colname="3">Expressions that result in a CHAR or VARCHAR value. Most
-general expressions can result in a CHAR or VARCHAR value.</entry>
+<entry align="left" colname="2" valign="bottom">Expression Type</entry>
+<entry align="left" colname="3" valign="bottom">Explanation</entry>
 </row>
+</thead>
+<tbody>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>String expressions<indexterm>with wildcards</indexterm></indexterm>A
-CHAR or VARCHAR value that uses wildcards.</p>  <p>Used in a LIKE pattern.</p></entry>
+<entry colname="2"> A CHAR or VARCHAR value that uses wildcards. </entry>
 <entry colname="3">The wildcards % and _ make a character string a pattern
 against which the LIKE operator can look for a match.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>Concatenation function<indexterm>as expression</indexterm></indexterm>Concatenation
-expression</p></entry>
+<entry colname="2"> Concatenation expression</entry>
 <entry colname="3">In a concatenation expression, the concatenation operator,
 "||", concatenates its right operand to the end of its left operand. Operates
 on character and bit strings. See <xref href="rrefsqlj40899.dita#rrefsqlj40899"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>Built-in string functions</p></entry>
+<entry colname="2"> Built-in string functions</entry>
 <entry colname="3">The built-in string functions act on a String and return
-a string. See <xref href="rrefsqlj97870.dita#rrefsqlj97870"></xref>, <xref href="rrefsqlj42049.dita#rrefsqlj42049"></xref>, <xref
-href="rrefsqlj32613.dita#rrefsqlj32613"></xref>, <xref href="rrefsqlj93082.dita#rrefsqlj93082"></xref>,
-and <xref href="rrefsqlj29930.dita#rrefsqlj29930.dita"></xref></entry>
+a string. See <xref href="rrefsqlj97870.dita#rrefsqlj97870"></xref>, <xref
+href="rrefsqlj42049.dita#rrefsqlj42049"></xref>, <xref href="rrefsqlj32613.dita#rrefsqlj32613"></xref>, <xref
+href="rrefsqlj93082.dita#rrefsqlj93082"></xref>, and <xref href="rrefsqlj29930.dita#rrefsqlj29930.dita"></xref></entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p>USER functions</p></entry>
+<entry colname="2"> USER functions</entry>
 <entry colname="3">User functions return information about the current user
-as a String. See <xref href="rrefsqlj42324.dita#rrefsqlj42324"></xref>, <xref href="rrefsqlj25228.dita#rrefsqlj25228"></xref>,
-and <xref href="rrefsqlj42476.dita#rrefsqlj42476"></xref></entry>
+as a String. See <xref href="rrefsqlj42324.dita#rrefsqlj42324"></xref>, <xref
+href="rrefsqlj25228.dita#rrefsqlj25228"></xref>, and <xref href="rrefsqlj42476.dita#rrefsqlj42476"></xref></entry>
 </row>
+</tbody>
+</tgroup>
+</table></p></section>
+<section><title>Date and time expressions</title><p>A date or time expression
+results in a DATE, TIME, or TIMESTAMP value. Most of the general expressions
+can result in a date or time value. <table frame="all" pgwide="0"><title>Table
+of date and time expressions</title>
+<tgroup cols="2" colsep="1" rowsep="1"><colspec colname="2" colnum="1" colwidth="300.00pt"/>
+<colspec colname="3" colnum="2" colwidth="500.00pt"/>
+<thead>
 <row>
-<entry nameend="2" namest="1"><i><ph><indexterm>Date/time expressions</indexterm></ph>Date/time
-expressions</i></entry>
-<entry colname="3">A date/time expression results in a DATE, TIME, or TIMESTAMP
-value. Most of the general expressions can result in a date/time value. </entry>
+<entry align="left" colname="2" valign="bottom">Expression type</entry>
+<entry align="left" colname="3" valign="bottom">Explanation</entry>
 </row>
+</thead>
+<tbody>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>CURRENT_DATE function<indexterm>as expression</indexterm></indexterm>CURRENT_DATE</p></entry>
+<entry colname="2"> CURRENT_DATE</entry>
 <entry colname="3">Returns the current date. See <xref href="rrefsqlj34177.dita#rrefsqlj34177"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>CURRENT_TIME function<indexterm>as expression</indexterm></indexterm>CURRENT_TIME</p></entry>
+<entry colname="2"> CURRENT_TIME</entry>
 <entry colname="3">Returns the current time. See <xref href="rrefsqlj33772.dita#rrefsqlj33772"></xref>.</entry>
 </row>
 <row>
-<entry colname="1"></entry>
-<entry colname="2"> <p><indexterm>CURRENT_TIMESTAMP function<indexterm>expression</indexterm></indexterm>CURRENT_TIMESTAMP</p></entry>
+<entry colname="2"> CURRENT_TIMESTAMP</entry>
 <entry colname="3">Returns the current timestamp. See <xref href="rrefsqlj15866.dita#rrefsqlj15866"></xref>.</entry>
 </row>
 </tbody>
@@ -237,4 +269,3 @@
 </table></p></section>
 </refbody>
 </reference>
-

Modified: db/derby/docs/trunk/src/ref/rrefsqlj23075.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqlj23075.dita?view=diff&rev=513085&r1=513084&r2=513085
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqlj23075.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefsqlj23075.dita Wed Feb 28 16:56:36 2007
@@ -1,4 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
+ 
+<!DOCTYPE reference PUBLIC "-//OASIS//DTD DITA Reference//EN"
+ "../dtd/reference.dtd">
 <!-- 
 Licensed to the Apache Software Foundation (ASF) under one or more
 contributor license agreements.  See the NOTICE file distributed with
@@ -15,24 +18,22 @@
 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="rrefsqlj23075" xml:lang="en-us">
-<title>Boolean expression</title>
+<title>Boolean expressions</title>
 <prolog><metadata>
-<keywords><indexterm>Boolean expression</indexterm></keywords>
+<keywords><indexterm>Boolean expressions</indexterm><indexterm>Boolean operators<indexterm>part
+of WHERE clause</indexterm></indexterm></keywords>
 </metadata></prolog>
 <refbody>
 <section><p>Boolean expressions are allowed in WHERE clauses and in check
 constraints. Boolean expressions in check constraints have limitations not
-noted here; see <xref href="rrefsqlj13590.dita#rrefsqlj13590"></xref> for more information.
-Boolean expressions in a WHERE clause have a highly liberal syntax; see <xref
-href="rrefsqlj33602.dita#rrefsqlj33602">WHERE clause</xref>, for example.</p></section>
+noted here; see <xref href="rrefsqlj13590.dita#rrefsqlj13590"></xref> for
+more information. Boolean expressions in a WHERE clause have a highly liberal
+syntax; see <xref href="rrefsqlj33602.dita#rrefsqlj33602">WHERE clause</xref>,
+for example.</p></section>
 <section><p>A boolean expression can include a boolean operator or operators.
-These are listed in <xref href="rrefsqlj23075.dita#rrefsqlj23075/sqlj34517"></xref>.   <table pgwide="1"
-frame="all" id="sqlj34517"><title><ph><indexterm>Boolean operators<indexterm>part
-of WHERE clause</indexterm></indexterm></ph>SQL Boolean Operators</title>
+These are listed in <xref href="rrefsqlj23075.dita#rrefsqlj23075/sqlj34517"></xref>.
+  <table frame="all" id="sqlj34517" pgwide="1"><title>SQL Boolean Operators</title>
 <tgroup cols="3" colsep="1" rowsep="1"><colspec colname="1" colnum="1" colwidth="24*"/>
 <colspec colname="2" colnum="2" colwidth="46*"/><colspec colname="3" colnum="3"
 colwidth="30*"/>
@@ -143,7 +144,8 @@
   FROM Flights
   WHERE dest_airport = 'SFO'
   AND orig_airport = 'GRU')</b></codeblock></entry>
-<entry colname="3"> <codeblock><b>[NOT] EXISTS <b><i><xref href="rreftablesubquery.dita#rreftablesubquery">TableSubquery</xref></i></b></b></codeblock></entry>
+<entry colname="3"> <codeblock><b>[NOT] EXISTS <b><i><xref href="rreftablesubquery.dita#rreftablesubquery">TableSubquery</xref></i></b></b></codeblock
+></entry>
 </row>
 <row>
 <entry colname="1">Quantified comparison<indexterm>Quantified comparison boolean
@@ -170,4 +172,3 @@
 </table></p></section>
 </refbody>
 </reference>
-