trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/5] trafodion git commit: Add ROLLUP Function for *Trafodion SQL Reference Manual*
Date Thu, 18 Jan 2018 18:47:09 GMT
Repository: trafodion
Updated Branches:
  refs/heads/master 03f705b0f -> 13840cee2


Add ROLLUP Function for *Trafodion SQL Reference Manual*


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/233d0962
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/233d0962
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/233d0962

Branch: refs/heads/master
Commit: 233d096295d239ac6ecf6a70c247b5ec33007dfb
Parents: 27897ca
Author: liu.yu <yu.liu@esgyn.cn>
Authored: Tue Jan 16 15:17:00 2018 +0800
Committer: liu.yu <yu.liu@esgyn.cn>
Committed: Tue Jan 16 15:17:00 2018 +0800

----------------------------------------------------------------------
 .../sql_functions_and_expressions.adoc          | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/233d0962/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
----------------------------------------------------------------------
diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
index 364211a..8f5ab1b 100644
--- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
+++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc
@@ -6338,6 +6338,27 @@ SET jobdesc = RIGHT (jobdesc, 12);
 ```
 
 <<<
+[[rollup_function]]
+== ROLLUP Function
+
+The ROLLUP function calculates multiple levels of subtotals aggregating from right to left
through the comma-separated list of columns, and provides a grand total. It is a an extension
to the `GROUP BY` clause and can be used with `ORDER BY` to sort the results.
+
+```
+SELECT…GROUP BY ROLLUP (column 1, [column 2,]…[column n])
+```
+
+ROLLUP generates n+1 levels of subtotals and grand total, where n is the number of the selected
column(s).
+
+For example, a query that contains three rollup columns returns the following rows:
+
+* First-level: stand aggregate values calculated by GROUP BY clause without using ROLLUP.
+* Second-level: subtotals aggregating across column 3 for each combination of column 1 and
column 2.
+* Third-level: subtotals aggregating across column 2 and column 3 for each column 1.
+* Fourth-level: the grand total row.
+
+NOTE: Trafodion does not support CUBE function which works slightly differently from ROLLUP.
+
+<<<
 [[round_function]]
 == ROUND Function
 


Mime
View raw message