Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

Operator precedence

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

jOOQ supports various operators, such as:

While in actual SQL, operator precedence is important (and quite vendor specific, unfortunately!), in jOOQ this topic is irrelevant, as there are always explicit parentheses imposed by the host language (Java, Kotlin, Scala), which remove all ambiguity. For example:

A AND B OR C -- same as (A AND B) OR C
A OR B AND C -- same as A OR (B AND C)
A.and(B).or(C)
A.or(B.and(C))

In other words, if you're chaining methods like this:

A.op1(B).op2(C).op3(D)

... then, you're nesting operands from left to right like this:

(((A op1 B) op2 C) op3 D)

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo