Logical OR (OR( || )) : OR « Logic Operator « MySQL Tutorial






When both operands are non-NULL, the result is 1 if any operand is non-zero, and 0 otherwise.

With a NULL operand, the result is 1 if the other operand is non-zero, and NULL otherwise.

If both operands are NULL, the result is NULL.

mysql>
mysql> SELECT 1 || 1;
+--------+
| 1 || 1 |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

mysql> SELECT 1 || 0;
+--------+
| 1 || 0 |
+--------+
|      1 |
+--------+
1 row in set (0.00 sec)

mysql> SELECT 0 || 0;
+--------+
| 0 || 0 |
+--------+
|      0 |
+--------+
1 row in set (0.00 sec)








8.4.OR
8.4.1.Logical OR (OR( || ))
8.4.2.Using Logical OR operator with NULL value
8.4.3.Using OR to link two conditions