Background documentationSearch Condition (search_condition) Locate this document in the navigation structure

 

A search condition (search_condition) links statements that can be true, false, or undefined. Rows in a table may be found that fulfill several conditions that are linked with AND or OR.

Structure

Syntax Syntax

  1. <search_condition> ::=
      <boolean_term>
    | <search_condition> OR <boolean_term>
    
    <boolean_term> ::=
      <boolean_factor>
    | <boolean_term> AND <boolean_factor>
    
    <boolean_factor> ::=
      [NOT] <predicate>
    | [NOT] (<search_condition>)
End of the code.

In the syntax element boolean_factor, the Boolean values (BOOLEAN) to be linked or their negation (NOT) are determined.

Explanation

Predicates in a WHERE clause are applied to the specified row or a group of rows in a table formed with the GROUP clause (see: Table Expression (table_expression). The results are linked using the specified Boolean operators (AND, OR, NOT).

If no parentheses are used, the precedence of the operators is as follows: NOT has a higher precedence than AND and OR. AND has a higher precedence than OR. Operators with the same precedence are evaluated from left to right.

NOT

X

NOT(x)

True

False

False

True

Undefined

Undefined

x AND y

x AND y

False

Undefined

True

False

False

False

False

Undefined

False

Undefined

Undefined

True

False

Undefined

True

x OR y

x OR y

False

Undefined

True

False

False

Undefined

True

Undefined

Undefined

Undefined

True

True

True

True

True

Note Note

A specific form of search condition is required for the SQL Optimizer to be able to determine the most efficient search strategy. For more information, see Concepts of the Database, Search Conditions.

End of the note.