Logical
Logical operators
Operator | Description | Example |
---|---|---|
| True if both values are true |
|
| True if either value is true |
|
| True if the value is false |
|
Effect of NULL
on logical operators
NULL
on logical operatorsAND
AND
The result of an AND
comparison may be NULL
if one or both sides of the expression are NULL
.
If, however, at least one side of an AND
operator is FALSE
, then the expression evaluates to FALSE
.
Transformation job example
SQL
Note that the example above casts null
as a Boolean
since using an untyped null is not currently supported and logical operators expect Boolean
inputs.
Query result:
and_example1 | and_example2 | and_example3 |
---|---|---|
| false |
|
OR
OR
The result of an OR
comparison may be NULL
if one or both sides of the expression are NULL
.
If, however, at least one side of an OR
operator is TRUE
the expression evaluates to TRUE
.
Transformation job example
SQL
Query result:
or_example1 | or_example2 | or_example3 |
---|---|---|
|
| true |
AND
and OR
truth table
AND
and OR
truth tableThe following truth table demonstrates the handling of NULL
in AND
and OR
:
a | b | a AND b | a OR b |
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NOT
NOT
The logical complement of NULL
is NULL
as shown in the following example with a transformation job.
SQL
Query result:
not_example |
---|
null |
NOT
truth table
NOT
truth tableThe following truth table demonstrates the handling of NULL
in NOT
:
a | NOT a |
---|---|
|
|
|
|
|
|
Last updated