Logical Operators
Logical
operators check the truth value of one or more expressions. In SQL
terms, a logical operator checks whether its operands are 0, nonzero,
or NULL
. A 0 value means false, nonzero means
true, and NULL
means no value.
-
NOT
or!
Performs a logical
not
(returns 1 if the value is 0 orNULL
; otherwise, returns 0)-
OR
or||
Performs a logical
or
(returns 1 if any of the arguments are nonzero and non-NULL
; otherwise, returns 0)-
AND
or&&
Performs a logical
and
(returns 0 if any of the arguments are 0 orNULL
; otherwise, returns 1)
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.