Conversion method: 1. Use CAST(), the syntax is "SELECT CAST('value' AS SIGNED);"; 2. Use CONVERT(), the syntax is "SELECT CONVERT('value', SIGNED);" ;3. Use the " " operator, the syntax is "SELECT 'value' 0;".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
Mysql method of converting values to numeric types
##Method 1: Use the CAST() function
CAST() function can convert a value (any type) to the specified data type Example:SELECT CAST('123' AS SIGNED);
Method 2: Use CONVERT() function
Example:
SELECT CONVERT('123',SIGNED);
Method 3: Use the " " operator
Example:SELECT '123'+0;
mysql video tutorial】
The above is the detailed content of How to convert value to numeric type in mysql. For more information, please follow other related articles on the PHP Chinese website!