O'Reilly logo

Managing & Using MySQL, 2nd Edition by Hugh E. Williams, Randy Yarger, George Reese, Tim King

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 or NULL; 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 or NULL; otherwise, returns 1)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required