github.com/mithrandie/csvq@v1.18.1/docs/_posts/2006-01-02-logic-operators.md (about)

     1  ---
     2  layout: default
     3  title: Logic Operators - Reference Manual - csvq
     4  category: reference
     5  ---
     6  
     7  # Logic Operators
     8  
     9  | operator | description |
    10  | :- | :- |
    11  | [AND](#and) | Logical AND |
    12  | [OR](#or)   | Logical OR |
    13  | [NOT, !](#not) | Logical NOT |
    14  
    15  A logic operator returns a ternary value.
    16  
    17  ## AND
    18  {: #and}
    19  
    20  ```sql
    21  condition AND condition
    22  ```
    23  
    24  _condition_
    25  : [value]({{ '/reference/value.html' | relative_url }})
    26  
    27  If either of conditions is FALSE, then return FALSE.
    28  If both of conditions are not FALSE, and either of conditions is UNKNOWN, then return UNKNOWN.
    29  Otherwise, return TRUE.
    30  
    31  ## OR
    32  {: #or}
    33  
    34  ```sql
    35  condition OR condition
    36  ```
    37  
    38  _condition_
    39  : [value]({{ '/reference/value.html' | relative_url }})
    40  
    41  If either of conditions is TRUE, then return TRUE.
    42  If both of conditions are not TRUE, and either of conditions is UNKNOWN, then return UNKNOWN.
    43  Otherwise, return FALSE.
    44  
    45  ## NOT
    46  {: #not}
    47  
    48  ```sql
    49  logical_not
    50    : NOT condition
    51    | !condition
    52  ```
    53  
    54  _condition_
    55  : [value]({{ '/reference/value.html' | relative_url }})
    56  
    57  If the condition is TRUE, then return FALSE.
    58  If the condition is FALSE, then return TRUE.
    59  IF the condition is UNKNOWN, then return UNKNOWN.
    60  
    61  _NOT_ and _!_ return the same value, but there is the difference of [precedence]({{ '/reference/operator-precedence.html' | relative_url }}) between these two operators.