From 419eedff5e432e162332637ad83cb1fa57aa263e Mon Sep 17 00:00:00 2001 From: lukaseder Date: Wed, 27 Jun 2018 15:50:04 +0200 Subject: [PATCH] [#7048] Document the FILTER clause --- .../resources/org/jooq/web/manual-3.10.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.11.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.12.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.6.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.7.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.8.xml | 34 +++++++++++++++++++ .../resources/org/jooq/web/manual-3.9.xml | 34 +++++++++++++++++++ 7 files changed, 238 insertions(+) diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml index 43698d372a..717ae43cd8 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.10.xml @@ -7679,6 +7679,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.11.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.11.xml index 705c9dfa55..479f8fde56 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.11.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.11.xml @@ -7893,6 +7893,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml index c9b3c21d6b..5841c4dbf3 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml @@ -7917,6 +7917,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.6.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.6.xml index fd1105e3fd..be93693fc4 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.6.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.6.xml @@ -7056,6 +7056,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.7.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.7.xml index 5eeeaadc9e..a5c954aa11 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.7.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.7.xml @@ -7320,6 +7320,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.8.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.8.xml index 5a6aab0d06..52902e40a5 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.8.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.8.xml @@ -7496,6 +7496,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.9.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.9.xml index fddf5184c2..f5bea3610c 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.9.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.9.xml @@ -7631,6 +7631,40 @@ GROUP BY AUTHOR_ID Aggregate functions have strong limitations about when they may be used and when not. For instance, you can use aggregate functions in scalar queries. Typically, this means you only select aggregate functions, no or other . Another use case is to use them along with a as seen in the previous example. Note, that jOOQ does not check whether your using of aggregate functions is correct according to the SQL standards, or according to your database's behaviour.

+

Filtered aggregate functions

+

+ The SQL standard specifies an optional FILTER clause, that can be appended to all aggregate functions. This is very useful to implement "pivot" tables, such as the following: +

+ + +SELECT + + + +

+ It is usually a good idea to calculate multiple aggregate functions in a single query, if this is possible. +

+ +

+ Only few databases (e.g. HSQLDB, PostgreSQL) implement native support for the FILTER clause. In all other databases, jOOQ emulates the clause using a : +

+ +SELECT + count(*), + count(CASE WHEN TITLE LIKE 'A%' THEN 1 END) +FROM BOOK + +

+ Aggregate functions exclude NULL values from aggregation, so the above query is equivalent to the one using FILTER. +

+

Ordered-set aggregate functions

Oracle and some other databases support "ordered-set aggregate functions". This means you can provide an ORDER BY clause to an aggregate function, which will be taken into consideration when aggregating. The best example for this is Oracle's LISTAGG() (also known as GROUP_CONCAT in other ). The following query groups by authors and concatenates their books' titles