Logical Operators - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

This happens because MySQL reads
representation is not good enough to hold the value, so it wraps to a signed integer.

12.3.3. Logical Operators

Table 12.4. Logical Operators
Name
[880]
AND,
&&
[880]
NOT,
!
[881]
||,
OR
[881]
XOR
In SQL, all logical operators evaluate to TRUE, FALSE, or
implemented as 1 (TRUE), 0 (FALSE), and NULL. Most of this is common to different SQL database
servers, although some servers may return any nonzero value for TRUE.
MySQL evaluates any nonzero,
assess to TRUE:
mysql>
SELECT 10 IS TRUE;
-> 1
mysql>
SELECT -10 IS TRUE;
-> 1
mysql>
SELECT 'string' IS NOT NULL;
-> 1
[880],
NOT
Logical NOT. Evaluates to
returns NULL.
mysql>
SELECT NOT 10;
-> 0
mysql>
SELECT NOT 0;
-> 1
mysql>
SELECT NOT NULL;
-> NULL
mysql>
SELECT ! (1+1);
-> 0
mysql>
SELECT ! 1+1;
-> 1
The last example produces
Note that the precedence of the
"Operator
[880],
AND
Logical AND. Evaluates to
are 0, otherwise
mysql>
SELECT 1 && 1;
-> 1
mysql>
SELECT 1 && 0;
-> 0
mysql>
SELECT 1 && NULL;
-> NULL
mysql>
SELECT 0 && NULL;
-> 0
mysql>
SELECT NULL && 0;
-> 0
non-NULL
[880]
!
if the operand is 0, to
1
because the expression evaluates the same way as (!1)+1.
1
NOT
Precedence".
[880]
&&
if all operands are nonzero and not NULL, to
1
is returned.
NULL
Logical Operators
9223372036854775808.0
Description
Logical AND
Negates value
Logical OR
Logical XOR
NULL
value to TRUE. For example, the following statements all
if the operand is nonzero, and
0
[880]
operator changed in MySQL 5.0.2. See
880
in an integer context. The integer
(UNKNOWN). In MySQL, these are
NOT NULL
Section 12.3.1,
if one or more operands
0

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents