Home > Database > Mysql Tutorial > body text

How to convert string to number in mysql

青灯夜游
Release: 2021-12-28 09:09:35
Original
71783 people have browsed it

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)".

How to convert string to number in mysql

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

## Floating point number: DECIMAL

【Related recommendations:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!