diff --git a/jOOQ-website/src/main/resources/html-util.xsl b/jOOQ-website/src/main/resources/html-util.xsl index 46fdc41ca5..b3dc7b8e5b 100644 --- a/jOOQ-website/src/main/resources/html-util.xsl +++ b/jOOQ-website/src/main/resources/html-util.xsl @@ -162,10 +162,10 @@
- + - +
diff --git a/jOOQ-website/src/main/resources/manual-2.5.xml b/jOOQ-website/src/main/resources/manual-2.5.xml index 19af5750dd..64d6c07fdd 100644 --- a/jOOQ-website/src/main/resources/manual-2.5.xml +++ b/jOOQ-website/src/main/resources/manual-2.5.xml @@ -2266,6 +2266,168 @@ FROM BOOK
Grouping functions +

ROLLUP() explained in SQL

+

+ The SQL standard defines special functions that can be used in the : the grouping functions. These functions can be used to generate several groupings in a single clause. This can best be explained in SQL. Let's take ROLLUP() for instance: +

+ + + + + + +

+ In English, the ROLLUP() grouping function provides N+1 groupings, when N is the number of arguments to the ROLLUP() function. Each grouping has an additional group field from the ROLLUP() argument field list. The results of the second query might look something like this: +

+ + + +

CUBE() explained in SQL

+

+ CUBE() is different from ROLLUP() in the way that it doesn't just create N+1 groupings, it creates all 2^N possible combinations between all group fields in the CUBE() function argument list. Let's re-consider our second query from before: +

+ + + + + + +

+ The results would then hold: +

+ + + +

GROUPING SETS()

+

+ GROUPING SETS() are the generalised way to create multiple groupings. From our previous examples +

+ +

+ This is nicely explained in the SQL Server manual pages about GROUPING SETS() and other grouping functions:
+ http://msdn.microsoft.com/en-us/library/bb510427(v=sql.105) +

+ +

jOOQ's support for ROLLUP(), CUBE(), GROUPING SETS()

+

+ jOOQ fully supports all of these functions, as well as the utility functions GROUPING() and GROUPING_ID(), used for identifying the grouping set ID of a record. The thus includes: +

+ + rollup(Field... fields); +Field cube(Field... fields); +Field groupingSets(Field... fields); +Field groupingSets(Field[]... fields); +Field groupingSets(Collection>... fields); + +// The utility functions generating IDs per GROUPING SET +Field grouping(Field); +Field groupingId(Field...);]]> + +

MySQL's and CUBRID's WITH ROLLUP syntax

+

+ MySQL and CUBRID don't know any grouping functions, but they support a WITH ROLLUP clause, that is equivalent to simple ROLLUP() grouping functions. jOOQ simulates ROLLUP() in MySQL and CUBRID, by rendering this WITH ROLLUP clause. The following two statements mean the same: +

+ + + + +