|
1 | 1 | ---
|
2 | 2 | title: SQL query operators for Azure Cosmos DB
|
3 | 3 | description: Learn about SQL operators such as equality, comparison, and logical operators supported by Azure Cosmos DB.
|
4 |
| -author: markjbrown |
| 4 | +author: timsander1 |
5 | 5 | ms.service: cosmos-db
|
6 | 6 | ms.topic: conceptual
|
7 |
| -ms.date: 12/02/2019 |
8 |
| -ms.author: mjbrown |
| 7 | +ms.date: 03/19/2020 |
| 8 | +ms.author: tisande |
9 | 9 |
|
10 | 10 | ---
|
11 | 11 | # Operators in Azure Cosmos DB
|
@@ -36,36 +36,51 @@ Logical operators operate on Boolean values. The following tables show the logic
|
36 | 36 |
|
37 | 37 | **OR operator**
|
38 | 38 |
|
39 |
| -| OR | True | False | Undefined | |
| 39 | +Returns `true` when either of the conditions is `true`. |
| 40 | + |
| 41 | +| | **True** | **False** | **Undefined** | |
40 | 42 | | --- | --- | --- | --- |
|
41 |
| -| True |True |True |True | |
42 |
| -| False |True |False |Undefined | |
43 |
| -| Undefined |True |Undefined |Undefined | |
| 43 | +| **True** |True |True |True | |
| 44 | +| **False** |True |False |Undefined | |
| 45 | +| **Undefined** |True |Undefined |Undefined | |
44 | 46 |
|
45 | 47 | **AND operator**
|
46 | 48 |
|
47 |
| -| AND | True | False | Undefined | |
| 49 | +Returns `true` when both expressions are `true`. |
| 50 | + |
| 51 | +| | **True** | **False** | **Undefined** | |
48 | 52 | | --- | --- | --- | --- |
|
49 |
| -| True |True |False |Undefined | |
50 |
| -| False |False |False |False | |
51 |
| -| Undefined |Undefined |False |Undefined | |
| 53 | +| **True** |True |False |Undefined | |
| 54 | +| **False** |False |False |False | |
| 55 | +| **Undefined** |Undefined |False |Undefined | |
52 | 56 |
|
53 | 57 | **NOT operator**
|
54 | 58 |
|
55 |
| -| NOT | | |
| 59 | +Reverses the value of any Boolean expression. |
| 60 | + |
| 61 | +| | **NOT** | |
56 | 62 | | --- | --- |
|
57 |
| -| True |False | |
58 |
| -| False |True | |
59 |
| -| Undefined |Undefined | |
| 63 | +| **True** |False | |
| 64 | +| **False** |True | |
| 65 | +| **Undefined** |Undefined | |
60 | 66 |
|
| 67 | +**Operator Precedence** |
| 68 | + |
| 69 | +The logical operators `OR`, `AND`, and `NOT` have the precedence level shown below: |
| 70 | + |
| 71 | +| **Operator** | **Priority** | |
| 72 | +| --- | --- | |
| 73 | +| **NOT** |1 | |
| 74 | +| **AND** |2 | |
| 75 | +| **OR** |3 | |
61 | 76 |
|
62 | 77 | ## * operator
|
63 | 78 |
|
64 | 79 | The special operator * projects the entire item as is. When used, it must be the only projected field. A query like `SELECT * FROM Families f` is valid, but `SELECT VALUE * FROM Families f` and `SELECT *, f.id FROM Families f` are not valid.
|
65 | 80 |
|
66 | 81 | ## ? and ?? operators
|
67 | 82 |
|
68 |
| -You can use the Ternary (?) and Coalesce (??) operators to build conditional expressions, as in programming languages like C# and JavaScript. |
| 83 | +You can use the Ternary (?) and Coalesce (??) operators to build conditional expressions, as in programming languages like C# and JavaScript. |
69 | 84 |
|
70 | 85 | You can use the ? operator to construct new JSON properties on the fly. For example, the following query classifies grade levels into `elementary` or `other`:
|
71 | 86 |
|
|
0 commit comments