SQL$HELP72.HLB  —  Predicates  Complex Predicate
    A complex predicate combines any number of predicates with the
    Boolean operators AND, OR, and NOT. Boolean operators are also
    called logical operators.

  (B)0complex-predicate =                                      
                                                           
  qwqwqqqqqqqqwqwqq> complex-predicate qwqqqwqqqqqqqqqqq> 
   x mq> NOT qj mqq> predicate qqqqqqqqqj   tq> AND qwqk  
   x                                        mq> OR qqj x  
   mqqqqqqqqqqqqqqqqqqqqqqqqq<qqqqqqqqqqqqqqqqqqqqqqqqqj  
                                                           

    When nesting predicates, you must enclose them in parentheses.
    SQL evaluates parts of a complex predicate in this order:

    1. Predicates enclosed in parentheses

       If there are nested predicates in parentheses, the innermost
       predicate is evaluated first.

    2. Predicates preceded by NOT

    3. Predicates combined with AND

    4. Predicates combined with OR

    The following tables summarize how SQL evaluates predicates
    combined with Boolean operators. Such tables are often called
    truth tables.

    Table 4 Boolean Operator: AND

    A              B              A AND B

    True           False          False
    True           True           True
    False          False          False
    False          True           False
    True           Unknown        Unknown
    False          Unknown        False
    Unknown        True           Unknown
    Unknown        False          False
    Unknown        Unknown        Unknown

    Table 5 Boolean Operator: OR

    A              B              A OR B

    True           False          True
    True           True           True
    False          False          False
    False          True           True
    True           Unknown        True
    False          Unknown        Unknown
    Unknown        True           True
    Unknown        False          Unknown
    Unknown        Unknown        Unknown

    Table 6 Boolean Operator: NOT

    A       NOT A

    True    False
    False   True
    Unknown Unknown

                                   NOTE

       The fact that NOT A is evaluated as unknown when A is
       unknown can be confusing in queries that refer to tables
       with null values. It means that a NOT predicate is not
       necessarily evaluated as true for all rows of a column for
       which the same predicate without NOT is evaluated as false.
       In other words, the result of a query that contains NOT A
       is not necessarily the complement of the result of the same
       query that contains only A.
Close Help