Reputation: 339
I have this simple query
SELECT *
FROM `book`
WHERE `BookID` = '7u'
LIMIT 1
i expect empty result But i see one result with book id =7. BookID is auto increment. Why query ignore 'u' character?
Upvotes: 3
Views: 81
Reputation: 2031
the mysql takes the string as 7u so when you try to do this stuff it coverts in a string but mysql is not in strict mode so it coverts string into integer because your id is intenger and its rounding of 7u becomes 7 thats why its display the one record try without quote 7u instead of '7u' then it gives error
Upvotes: 0
Reputation: 12733
Just because of two reasons:
There may be only one record.
you were using LIMIT 1. That display only one record from the output. so use LIMIT 5 OR 2.
Upvotes: 0
Reputation: 57764
Because 7u
is not numeric, so apparently mysql is ignoring the u
.
Maybe you are thinking of some high level programming languages which use suffixes to qualify the type of number? In C-derived languages, 7u would be an unsigned integer with value 7.
Upvotes: 4