Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (Français) » SQL Anywhere Server - SQL Reference » Using SQL » SQL language elements » Operators


Logical operators

Search conditions can be combined using the AND or OR operators. You can also negate them using the NOT operator, or test whether an expression would evaluate to true, false, or unknown, using the IS operator.

  • AND operator   The AND operator is placed between search conditions as follows:

    .. WHERE condition1 AND condition2

    When using AND, the combined condition is TRUE if both conditions are TRUE, FALSE if either condition is FALSE, and UNKNOWN otherwise.

  • OR operator   The OR operator is placed between search conditions as follows:

    .. WHERE condition1 OR condition2

    When using OR, the combined condition is TRUE if either condition is TRUE, FALSE if both conditions are FALSE, and UNKNOWN otherwise.

  • NOT operator   The NOT operator is placed before a condition to negate the condition, as follows:

    .. WHERE NOT condition

    The NOT condition is TRUE if condition is FALSE, FALSE if condition is TRUE, and UNKNOWN if condition is UNKNOWN.

  • IS operator   The IS operator is placed between an expression and the truth value you are testing for. The syntax for the IS operator is as follows:

    expression IS [ NOT ] truth-value

    The IS condition is TRUE if the expression evaluates to the supplied truth-value, which must be one of TRUE, FALSE, UNKNOWN, or NULL. Otherwise, the value is FALSE.

    For example, 5*3=15 IS TRUE tests whether the expression 5*3=15 evaluates to TRUE.

See also: Three-valued logic.