Logical operators mysql

The NOT
!
Logical NOT. If the operand is 0, 1 return; if the operand is non-zero, return 0; if the operand is NOT NULL, return NULL.

MySQL> the NOT 10 the SELECT;
-> 0
MySQL> the NOT the SELECT 0;
-> 1
MySQL> the SELECT 1 + 1;!
-> 1
The last example returns 1, because the expression is calculated as +1 (1!) .

AND ,&&

.. When the logic 1 on both sides at the same time the expression, the function returns true expression only, otherwise to false ..

mysql> SELECT 1 && 1;
-> 1
mysql> SELECT 1 && 0;
-> 0

or ,||

Or logic. . When both sides at the same time the expression is 0, the function expression to return false, otherwise true ..

mysql> SELECT 1 || 1;
-> 1
mysql> SELECT 1 || 0;
-> 1

xor

Exclusive logical OR. . Returns true when different function when both sides of the expression, true otherwise ..

Guess you like

Origin www.cnblogs.com/Damocless/p/11993168.html