Open
Description
The current implementation of BETWEEN
is the (implicit) BETWEEN ASYMMETRIC
behaviour defined in the SQL standard. Also add the SYMMETRIC
behaviour (and make it possible to specify ASYMMETRIC
explicitly), also know as Feature T461, “Symmetric BETWEEN predicate”.
ISO-9075-2:2023 specifies (8.3 <between predicate>):
<between predicate> ::=
<row value predicand> <between predicate part 2>
<between predicate part 2> ::=
[ NOT ] BETWEEN [ ASYMMETRIC | SYMMETRIC ]
<row value predicand> AND <row value predicand>
Syntax Rules
- If neither SYMMETRIC nor ASYMMETRIC is specified, then ASYMMETRIC is implicit.
- Let X, Y, and Z be the first, second, and third <row value predicand>s, respectively.
- “X NOT BETWEEN SYMMETRIC Y AND Z” is equivalent to “NOT ( X BETWEEN SYMMETRIC Y AND Z )”.
- “X BETWEEN SYMMETRIC Y AND Z” is equivalent to “((X BETWEEN ASYMMETRIC Y AND Z) OR (X BETWEEN ASYMMETRIC Z AND Y))”.
- “X NOT BETWEEN ASYMMETRIC Y AND Z” is equivalent to “NOT ( X BETWEEN ASYMMETRIC Y AND Z )”.
- “X BETWEEN ASYMMETRIC Y AND Z” is equivalent to “X>=Y AND X<=Z”.
- The Conformance Rules of Subclause 8.2, “<comparison predicate>”, are applied to the result of all syntactic transformations specified in this Subclause.
(no access rules and general rules)