Operators
|
69
value1 NOT LIKE value2
Compares value1 to value2 and matches the rows if they
differ. This is identical to
NOT (value1 LIKE value2).
value1 REGEXP/RLIKE value2
Compares value1 to value2 using the extended regular
expression syntax and matches the rows if the two val-
ues match. The righthand value can contain full Unix
regular expression wildcards and constructs (e.g.,
SELECT
name FROM people WHERE name RLIKE
'^B.*').
value1 NOT REGEXP value2
Compares value1 to value2 using the extended regular
expression syntax and matches the rows if they differ.
This is identical to
NOT (value1 REXEXP value2).
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, NULL if
it is
NULL, otherwise “0”).
OR or ||
Performs a logical or (returns “1” if any of the arguments
are nonzero and non-
NULL, NULL if any are NULL; other-
wise, returns “0”).
XOR
Performs a logical exclusive or (returns “1” if one and
only on argument is nonzero and non-
NULL, NULL if any
are
NULL; otherwise. returns “0”).
AND or &&
Performs a logical and (returns “0” if any of the argu-
ments are 0,
NULL if any are NULL; otherwise, returns “1”).

Get MySQL Pocket Reference 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.