Implicit automatic casting

suggest change
select '123' * 2;

To make the multiplication with 2 MySQL automatically converts the string 123 into a number.

Return value:

246

Conversion reads digits from the left. If the string does not start with a number, the result is 0. A leading number is used and the rest of the string is ignored. In strict SQL mode, that ignored tail is a warning, not an error, for this expression.

select '123ABC' * 2

Return value:

246

select 'ABC123' * 2

Return value:

0

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents