Reputation: 45
So, I have a table with 2 columns
[Col_1 and type int(11) Auto Increment] and
[Col_2 and type int(11) NULL]
Let's assume in that table we have 3 rows.
1 7
2 7
3 6
The question is why this statement(query) is correct and why is returning such result ?
SELECT * from table WHERE Col_2 = '7%fdh(ds;ds)dsa'
Result:
1 7
2 7
Upvotes: 1
Views: 45
Reputation: 1738
This is the implicit type conversion MySQL uses when you have different types that you compare.
See documentation about type conversion in the manual.
Quote:
When an operator is used with operands of different types, type conversion occurs to make the operands compatible. Some conversions occur implicitly. For example, MySQL automatically converts strings to numbers as necessary, and vice versa.
Upvotes: 1