MySQL Forums
Forum List  »  Newbie

Re: Strange result from DELETE query - can anyone explain?!
Posted by: Jay Alverson
Date: March 20, 2009 06:06PM

It's not like 4 = True (True being a constant in MySQL).

All it is that you're offering something that's not False. So

... column = 3 or 10000

is also true.

mysql> select 4 is True;
+-----------+
| 4 is True |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)

mysql> select 77 is True;
+------------+
| 77 is True |
+------------+
|          1 |
+------------+
1 row in set (0.00 sec)

I'm using v5.0.67

Download the MySQL Manual for your version at:
http://dev.mysql.com/doc/#refman

Checkout Chapter 11.2.3. Comparison Functions and Operators

IS boolean_value 

Tests a value against a boolean value, where boolean_value can be TRUE, FALSE, or UNKNOWN. 

mysql> SELECT 1 IS TRUE, 0 IS FALSE, NULL IS UNKNOWN;
        -> 1, 1, 1

IS boolean_value syntax was added in MySQL 5.0.2.

>

Thanks, Jay

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.