NexusDB Manual V3 > SQL Reference > Value Expressions
Specify a boolean value.
Syntax
<boolean value expression> ::=
<boolean term> ::=
<boolean factor> ::= [ NOT ] <boolean test>
<boolean test> ::= <boolean primary> [ IS [ NOT ] <truth value> ]
<truth value> ::=
<boolean primary> ::=
<boolean predicand> ::=
Notes
<boolean primary> IS NOT <truth value>
is equivalent to:
NOT <boolean primary> IS <truth value>
Truth tables
Since SQL supports null values and predicates whose value can be UNKNOWN, a three-valued logic is used to evaluate boolean value expressions. The rules of this logic are summarized in the following tables:
Truth Table for the AND Boolean Operator
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ _____________________________________________________________________________
Truth Table for the OR Boolean Operator
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ _____________________________________________________________________________
Truth Table for the NOT Boolean Operator
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ _____________________________________________________________________________
Truth Table for the IS Boolean Operator
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ _____________________________________________________________________________
Examples
SELECT studentID, studentName, city, state FROM students WHERE city = 'Newport' AND state = 'CA'
SELECT studentID, studentName, city, state FROM students WHERE city = 'Newport' AND ( state = 'CA' OR state = 'RI' )
SELECT studentID, studentName, city, state FROM students WHERE ( city = 'Newport' AND state = 'CA' ) OR state = 'MA'
SELECT studentID, studentName, city, state FROM students WHERE NOT ( ( city = 'Boston' AND state = 'MA' ) OR state = 'CA' )
Conformance
|
© Nexus Database Systems Pty Ltd.