Logical Operators

Logical operators are used to operate on one or more operands and return a boolean result.

Syntax

 
    select * from ...
    where expression1 and  expression2
     
    select * from ...
    where expression1 or expression2
     
    select * from ...
    where not expression1
     

The eXtremeSQL logical operators are the following:

and True if both expressions are true
or True if one or both of the expressions is true
not True if the expression is false

These logical operators can also be used to perform bitwise operations. Please see the Bitwise Operations page for further details.

Examples

 
    select 1 < 2 and 2 > 3;
    #1
    ------------------------------------------------------------------------------
    false
 
    Selected records: 1
     
    select 1 < 2 or 2 > 3;
    #1
    ------------------------------------------------------------------------------
    true
 
    Selected records: 1
     
    create table t(i integer, d date);
    insert into t values([3,5],['2017-01-01','2017-02-01']);
     
    select * from t where not i = 2;
    i       d
    ------------------------------------------------------------------------------
    3       01/01/2017 00:00:00
    5       02/01/2017 00:00:00
 
    Selected records: 2