The jOOQ User Manual. Multiple Pages : SQL building : Conditional expressions : BETWEEN predicate (degree > 1) | previous : next |
All versions: 3.12 | 3.11 | 3.10 | 3.9 | 3.8 | 3.7 | Development versions: 3.13 | Unsupported versions: 3.6 | 3.5 | 3.4 | 3.3 | 3.2
BETWEEN predicate (degree > 1)
Available in ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
The SQL BETWEEN
predicate also works well for row value expressions. Much like the BETWEEN predicate for degree 1, it is defined in terms of a pair of regular comparison predicates:
[A] BETWEEN [B] AND [C] [A] BETWEEN SYMMETRIC [B] AND [C]
[A] >= [B] AND [A] <= [C] ([A] >= [B] AND [A] <= [C]) OR ([A] >= [C] AND [A] <= [B])
The above can be factored out according to the rules listed in the manual's section about row value expression comparison predicates.
jOOQ supports the BETWEEN [SYMMETRIC]
predicate and emulates it in all SQL dialects where necessary. An example is given here:
row(BOOK.ID, BOOK.TITLE).between(1, "A").and(10, "Z");