When relation-conditions are written consecutively, any relation-condition after the first can be abbreviated in one of two ways:
Format >>-relation-condition-------------------------------------------> .---------------------------------------------------. V | >----+-AND-+--+-----+--+---------------------+--object-+------->< '-OR--' '-NOT-' '-relational-operator-'
In any consecutive sequence of relation-conditions, both forms of abbreviation can be specified. The abbreviated condition is evaluated as if:
The resulting combined condition must comply with the rules for element sequences in combined conditions, as shown in Combined conditions.
If NOT is immediately followed by GREATER THAN, >, LESS THAN, <, EQUAL TO, or =, then the NOT participates as part of the relational operator. NOT in any other position is considered a logical operator (and thus results in a negated relation condition).
You can use parentheses in combined relation conditions to specify an intended order of evaluation. Using parentheses can also help improve the readability of conditional expressions.
The following rules govern the use of parentheses in abbreviated combined relation conditions:
A = B and not A not = C A = B and not not = C
The following table summarizes the rules for forming an abbreviated combined relation condition.
| Combined condition element | Left- most | When not leftmost, can be immediately preceded by: | Right- most | When not rightmost, can be immediately followed by: |
|---|---|---|---|---|
| Subject | Yes | NOT |
No | Relational operator |
| Object | No | Relational operator |
Yes | AND |
| Relational operator | No | Subject |
No | Object |
AND |
No | Object |
No | Object |
| NOT | Yes | AND |
No | Subject |
| ( | Yes | Relational operator |
No | Subject |
| ) | No | Object |
Yes | AND |
The following table shows examples of abbreviated combined relation conditions, with and without parentheses, and their unabbreviated equivalents.
| Abbreviated combined relation condition | Equivalent |
|---|---|
| A = B AND NOT < C OR D | ((A = B) AND (A NOT < C)) OR (A NOT < D) |
| A NOT > B OR C | (A NOT > B) OR (A NOT > C) |
| NOT A = B OR C | (NOT (A = B)) OR (A = C) |
| NOT (A = B OR < C) | NOT ((A = B) OR (A < C)) |
| NOT (A NOT = B AND C AND NOT D) | NOT ((((A NOT = B) AND (A NOT = C)) AND (NOT (A NOT = D)))) |