Home > Database > Mysql Tutorial > body text

How to convert numbers to string in mysql

青灯夜游
Release: 2021-12-28 16:51:58
Original
41768 people have browsed it

Mysql method of converting numbers to strings: 1. Use the CHAR() function, syntax "SELECT CONVERT (numeric value, CHAR);"; 2. Use the " " operator to combine numbers with the empty string Addition, syntax "SELECT value'';".

How to convert numbers to string in mysql

The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.

mysql converts numbers into strings

1. If numbers are converted into strings, you can use CHAR. Take a look at sql Statement:

SELECT CONVERT(23,CHAR);
Copy after login

The running results are shown in the figure below.

2. To convert numbers into strings, you can also directly use the "''" method. The sql statement is as follows:

SELECT 123+'';
Copy after login

The running result of this sql is as shown in the figure.

[Related recommendations: mysql video tutorial]

The above is the detailed content of How to convert numbers to string 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!