Have a table ,
root@localhost:[test]05:35:05>desc t;
+-----------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | De
The cause is how mysql silently converts text to numbers to evaluate the number=text expression as described in mysql's documentation on type conversion in expression evaluation.
Number=text comparison expressions are evaluated by converting both operands to floating point numbers.
Text is converted to a number by evaluating the characters from left to right. As long as the characters can be evaluated as a valid number (sign, numbers, decimal point, etc), mysql considers it as a number. The conversion stops in the moment mysql encounters a character that cannot be used in a number (such as a letter), or would result in an ivalid number (such as a 2nd sign).
Text 'foo1'
is converted to 0 because its leftmost character is a letter.
Text '299a0be4a5a79e6a59fdd251b19d78bb'
is converted to 299 because it starts with the characters 299 and then comes the letter a
that cannot be interpreted as a number.