Return-Path:
X-Original-To: apmail-db-derby-commits-archive@www.apache.org
Delivered-To: apmail-db-derby-commits-archive@www.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id 0FA58F638
for ;
Wed, 1 May 2013 13:38:33 +0000 (UTC)
Received: (qmail 23262 invoked by uid 500); 1 May 2013 13:38:33 -0000
Delivered-To: apmail-db-derby-commits-archive@db.apache.org
Received: (qmail 23113 invoked by uid 500); 1 May 2013 13:38:28 -0000
Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm
Precedence: bulk
list-help:
list-unsubscribe:
List-Post:
Reply-To: "Derby Development"
List-Id:
Delivered-To: mailing list derby-commits@db.apache.org
Received: (qmail 23077 invoked by uid 99); 1 May 2013 13:38:27 -0000
Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2013 13:38:27 +0000
X-ASF-Spam-Status: No, hits=-2000.0 required=5.0
tests=ALL_TRUSTED
X-Spam-Check-By: apache.org
Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4)
by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 May 2013 13:38:26 +0000
Received: from eris.apache.org (localhost [127.0.0.1])
by eris.apache.org (Postfix) with ESMTP id 124FE23888CD;
Wed, 1 May 2013 13:38:06 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: svn commit: r1477997 - in /db/derby/docs/trunk/src/ref:
refderby.ditamap
rreffuncrownumber.dita rrefkeywords29722.dita rrefselectexpression.dita
rrefsqljwindow.dita
Date: Wed, 01 May 2013 13:38:05 -0000
To: derby-commits@db.apache.org
From: chaase3@apache.org
X-Mailer: svnmailer-1.0.8-patched
Message-Id: <20130501133806.124FE23888CD@eris.apache.org>
X-Virus-Checked: Checked by ClamAV on apache.org
Author: chaase3
Date: Wed May 1 13:38:05 2013
New Revision: 1477997
URL: http://svn.apache.org/r1477997
Log:
DERBY-6103 Improve documentation of ROW_NUMBER function
Modified 3 Reference Manual topics and added a new one.
Patch: DERBY-6103-5.diff
Added:
db/derby/docs/trunk/src/ref/rrefsqljwindow.dita (with props)
Modified:
db/derby/docs/trunk/src/ref/refderby.ditamap
db/derby/docs/trunk/src/ref/rreffuncrownumber.dita
db/derby/docs/trunk/src/ref/rrefkeywords29722.dita
db/derby/docs/trunk/src/ref/rrefselectexpression.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=1477997&r1=1477996&r2=1477997&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/refderby.ditamap (original)
+++ db/derby/docs/trunk/src/ref/refderby.ditamap Wed May 1 13:38:05 2013
@@ -694,6 +694,7 @@ limitations under the License.
+
Modified: db/derby/docs/trunk/src/ref/rreffuncrownumber.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rreffuncrownumber.dita?rev=1477997&r1=1477996&r2=1477997&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rreffuncrownumber.dita (original)
+++ db/derby/docs/trunk/src/ref/rreffuncrownumber.dita Wed May 1 13:38:05 2013
@@ -26,18 +26,24 @@ limitations under the License.
- The ROW_NUMBER function does not take any arguments, and for each row over the window it returns an ever increasing BIGINT. It is normally used to limit the number of rows returned for a query. The LIMIT keyword used in other databases is not defined in the SQL standard, and is not supported.
-
-- Derby does not currently allow the named or unnamed window specification to be specified in the OVER() clause, but requires an empty parenthesis. This means the function is evaluated over the entire result set.
-- The ROW_NUMBER function cannot currently be used in a WHERE clause.
-- Derby does not currently support ORDER BY in subqueries, so there is currently no way to guarantee the order of rows in the SELECT subquery. An optimizer override can be used to force the optimizer to use an index ordered on the desired column(s) if ordering is a firm requirement.
-
-The data type of the returned value is a BIGINT number.
+ The ROW_NUMBER function does not take any arguments, and for each
+row over the window it returns an ever increasing BIGINT. It is normally used to
+limit the number of rows returned for a query. A
+result offset or fetch
+first clause can be a more efficient way to perform this task.
+The data type of the returned value is BIGINT.
-
-Syntax ROW_NUMBER() OVER ()
-
-ExampleTo limit the number of rows returned from a query to the 10 first rows of table T, use the following query:
+Syntax
+ROW_NUMBER() OVER [ WindowSpecification | WindowName ]
+Currently, the only valid WindowSpecification is an empty pair of
+parentheses (()), which indicates that the function is
+evaluated over the entire result set.
+If you choose to use a
+WINDOW clause in a
+SelectExpression
+to specify a window, you must specify a WindowName to refer to it.
+
+ExamplesTo limit the number of rows returned from a query to the 10 first rows of table T, use the following query:
SELECT * FROM (
SELECT
@@ -47,6 +53,14 @@ SELECT * FROM (
) AS TR
WHERE R <= 10;
+To display the result of a query using a window name in a WINDOW clause:
+
+
+SELECT ROW_NUMBER() OVER R,
+ B,
+ SUM(A)
+FROM T5 GROUP BY B WINDOW R AS ()
+
Modified: db/derby/docs/trunk/src/ref/rrefkeywords29722.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefkeywords29722.dita?rev=1477997&r1=1477996&r2=1477997&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefkeywords29722.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefkeywords29722.dita Wed May 1 13:38:05 2013
@@ -234,6 +234,7 @@ compact="yes">
VIEW
WHENEVER
WHERE
+WINDOW
WITH
WORK
WRITE
Modified: db/derby/docs/trunk/src/ref/rrefselectexpression.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefselectexpression.dita?rev=1477997&r1=1477996&r2=1477997&view=diff
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefselectexpression.dita (original)
+++ db/derby/docs/trunk/src/ref/rrefselectexpression.dita Wed May 1 13:38:05 2013
@@ -33,6 +33,7 @@ other tables.
[ WHERE clause ]
[ GROUP BY clause ]
[ HAVING clause ]
+[ WINDOW clause ]
[ ORDER BY clause ]
[ result offset clause ]
[ fetch first clause ]
@@ -83,6 +84,10 @@ table. If the HAVING clause evaluates to
processing. If the HAVING clause evaluates to FALSE or NULL, the row is discarded.
If there is a HAVING clause but no GROUP BY, the table is implicitly grouped
into one group for the entire table.
+The WINDOW clause allows you to refer to a window by name when you use a
+ in a
+SelectExpression.
+
The ORDER BY clause allows you to specify the order in which rows appear in
the result set. In subqueries, the ORDER BY clause is meaningless unless it is
accompanied by one or both of the result offset and fetch first clauses or in
@@ -97,6 +102,7 @@ a SelectExpression in the followi
WHERE clause
GROUP BY (or implicit GROUP BY)
HAVING clause
+WINDOW clause
ORDER BY clause
Result offset clause
Fetch first clause
Added: db/derby/docs/trunk/src/ref/rrefsqljwindow.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/trunk/src/ref/rrefsqljwindow.dita?rev=1477997&view=auto
==============================================================================
--- db/derby/docs/trunk/src/ref/rrefsqljwindow.dita (added)
+++ db/derby/docs/trunk/src/ref/rrefsqljwindow.dita Wed May 1 13:38:05 2013
@@ -0,0 +1,51 @@
+
+
+
+
+WINDOW clause
+
+WINDOW clause
+
+
+
+The WINDOW clause allows you to refer to a window by name when you use a
+ in a
+SelectExpression.
+
+
+
+Syntax
+WINDOW WindowName AS WindowSpecification
+In a WINDOW clause, WindowName is a
+SQL92Identifier.
+Currently, the only valid WindowSpecification is a set of empty
+parentheses (()), which indicates that the function is
+evaluated over the entire result set.
+
+Example
+
+SELECT ROW_NUMBER() OVER R,
+ B,
+ SUM(A)
+FROM T5 GROUP BY B WINDOW R AS ()
+
+
+
+
+
Propchange: db/derby/docs/trunk/src/ref/rrefsqljwindow.dita
------------------------------------------------------------------------------
svn:eol-style = native