Operator precedence is SQL-like (not Java-like). When there is more than one logical operator in a statement, and they are not explicitly grouped using parentheses, NOT is evaluated first, then AND, and finally OR.
运算符优先级类似于SQL(而不是Java)。如果一个语句中有多个逻辑运算符,并且它们没有使用括号显式分组,则NOT最优先,其次是AND,最后是OR。
The following shows the operator precedence from highest to lowest:
以下显示了从最高到最低的运算符优先级:
"
[, ], <, >
()
~ (prefix and postfix), =
^
+, |, -
NOT,
AND
OR
AND and OR can be combined with +, |, - with the following meanings:
AND和OR可以与+、|、-结合使用,其含义如下:
AND (no prefix is the same as +) | Explanation |
---|---|
big AND dog | big and dog must occur |
+big AND +dog | big and dog must occur |
big AND +dog | big and dog must occur |
+big AND dog | big and dog must occur |
big AND |dog | big must occur and dog should occur |
|big AND dog | big should occur and dog must occur |
|big AND |dog | both big and dog should occur, and at least one must match |
big AND -dog | big must occur and dog must not occur |
-big AND dog | big must not occur and dog must occur |
-big AND -dog | both big and dog must not occur |
|big AND -dog | big should occur and dog must not occur |
OR (no prefix is the same as +) | Explanation |
---|---|
dog OR wolf | dog and wolf should occur, and at least one must match |
+dog OR +wolf | dog and wolf should occur, and at least one must match |
dog OR +wolf | dog and wolf should occur, and at least one must match |
+dog OR wolf | dog and wolf should occur, and at least one must match |
dog OR |wolf | dog and wolf should occur, and at least one must match |
|dog OR wolf | dog and wolf should occur, and at least one must match |
|dog OR |wolf | dog and wolf should occur, and at least one must match |
dog OR -wolf | dog should occur and wolf should not occur, one of the clauses must be valid for any result |
-dog OR wolf | dog should not occur and wolf should occur, one of the clauses must be valid for any result |
-dog OR -wolf | dog and wolf should not occur, one of the clauses must be valid for any result |
文档更新时间: 2020-02-09 16:31 作者:凌云文档