Operator Precedence

The relative precedence among the various operators and expressions in SQL for Oracle NoSQL Database is defined implicitly by the order in which the grammar rules for these operators and expressions are listed in the grammar specification. Specifically, the earlier a grammar rule appears, the lower its precedence. For example, consider the following 3 rules that define the syntax for the OR, AND, and NOT operators. Because or_expr appears before and_expr and not expr, OR has lower precedence than AND and NOT. And AND has lower precedence than NOT, because and_expr appears before not_expr. As a result, an expression like a = 10 and not b > 5 or c < 20 and c > 1 is equivalent to (a = 10 and (not b > 5)) or (c < 20 and c > 1). See Logical Operators: AND, OR, and NOT for more details.

or_expression ::= and_expression | (or_expression OR and_expression)
and_expression ::= not_expression | (and_expression AND not_expression)
not_expression ::= [NOT] is_null_expression