Mysql method to convert a string into a number: 1. Use the " " operator, the syntax "'string' 0"; 2. Use the cast() function, the syntax "cast('string' as Numerical type)"; 3. Use the convert() function, the syntax is "convert('string', numerical type)".

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
mysql Three ways to convert string to number
Method 1: 0

Method 2: cast('string' as numerical type)
Numeric types can be divided into three types:
Integers: SIGNED

Unsigned integer: UNSIGNED

Floating point number: DECIMAL

Method 3: convert('string', numeric type)
Numeric types can also be divided into three types:
Integer: SIGNED

Unsigned integer: UNSIGNED


mysql video tutorial】
The above is the detailed content of How to convert string to number in mysql. For more information, please follow other related articles on the PHP Chinese website!