I am studying a bit of MySQL and I have found something relatively strange. I have a table with certain columns, one is id, which is a number. At some point a query like this:
SELECT name,surname,etc from table where id='1 thousand'
came in. It behaves exactly as if the value to compare was just 1. So, I read the docs about implicit conversion and did not find the specific rules about this conversion. I did some testing and found that, apparently, when converting a string to a number the conversion stops as soon as a non-numeric character is found. I am pretty certain about this because of my testing. However I would like to confirm it properly. Can anyone point to a place where this is documented? The closest I got to it was the line:
The reason for this is that there are many different strings that may convert to the value 1, such as '1', ' 1', or '1a'.
in: https://dev.mysql.com/doc/refman/8.0/en/type-conversion.html Which does mention it, but does not defines the exact rules for it. I am guessing that spaces are removed and conversion stops at the first non-numeric character. Someone has insight on where to find these rules?
The mentioned question in the closure reason asks about whether or not certain values are converted to 1:
'1234'=1234 ?
'1abc' = 1 ?
'text' = 1 ?
My question is not about which values are converted to X or Y. I already know by experimentation and reading some of that, as I understand implicit conversion. My question is about the rules that define the implicit conversion. Like stated above, I have certain suspicions about these rules, but I don't find a documentation that covers this topic. The linked resource in the accepted answer in the other question is the same I included in the question, and does note explain the conversion rules, which is what is being asked in this question.