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?
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.
u. Why is it there in the first place? Also, look at the data. With an autoincrement column, it is strictly numeric.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.
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
BookIDfield).