Spec-Zone .ru
спецификации, руководства, описания, API

12.3.3. Logical Operators

Table 12.4. Logical Operators

Name Description
AND, && Logical AND
NOT, ! Negates value
||, OR Logical OR
XOR Logical XOR

In SQL, all logical operators evaluate to TRUE, FALSE, or NULL (UNKNOWN). In MySQL, these are implemented as 1 (TRUE), 0 (FALSE), and NULL. Most of this is common to different SQL database servers, although some servers may return any nonzero value for TRUE.

MySQL evaluates any nonzero, non-NULL value to TRUE. For example, the following statements all assess to TRUE:

mysql> SELECT 10 IS TRUE;-> 1mysql> SELECT -10 IS TRUE;-> 1mysql> SELECT
        'string' IS NOT NULL;-> 1