SAND CDBMS SQL Reference Guide
Selection Criteria for WHERE and HAVING Clauses

 
x
Next Topic:
Predicates

 

Boolean Value Expressions (Search Conditions)


Boolean value expressions are used in SAND CDBMS SQL to specify a search condition that can be used in a variety of SQL statements, including SELECT statements, searched UPDATE or DELETE statements, and many more. These expressions use various predicates to test a particular operand (for example, the contents of a column) for membership in a specified set of values. If the operand satisfies the condition, it is TRUE; if it does not satisfy the condition, it is FALSE; a NULL value can force a Boolean expression to evaluate to UNKNOWN.

When the NOT operator is used, the following Boolean values are equivalent:


Syntax

 
Boolean value expressions can specify a single search condition or can combine multiple conditions linked by the AND / OR keywords. The order in which Boolean operators are evaluated within an expression is as follows, unless altered by the presence of parentheses: NOT, AND, then OR.

Note that parentheses (...) can be placed around individual predicates, groups of predicates, and even the whole Boolean value expression. If a predicate (or collection of predicates) is enclosed by parentheses, it will be evaluated first. If parenthetical expressions are nested, the innermost condition surrounded by parentheses is evaluated before all others. Placing parentheses around logical operations also enhances the readability of the SQL, especially if there are many predicates in the expression.

The evaluation of different Boolean expressions combined with the AND / OR operators are shown in the following tables:
 

AND true false unknown
true true false unknown
false false false false
unknown unknown false unknown

 
 
OR true false unknown
true true true true
false true false unknown
unknown true unknown unknown

 

 

x
Chapter Index
Next Topic:
Predicates