Home > Database > Mysql Tutorial > body text

mysql向表中某字段后追加一段字符串:

WBOY
Release: 2016-05-31 08:48:40
Original
875 people have browsed it

mysql向表中某字段后追加一段字符串:update table_name set field=CONCAT(field,'',str)

mysql 向表中某字段前加字符串update table_name set field=CONCAT('str',field)

MySQL中concat函数

使用方法:

CONCAT(str1,str2,…)  

返回结果为连接参数产生的字符串。如有任何一个参数为NULL ,则返回值为 NULL。

注意:

如果所有参数均为非二进制字符串,则结果为非二进制字符串。 

如果自变量中含有任一二进制字符串,则结果为一个二进制字符串。

一个数字参数被转化为与之相等的二进制字符串格式;若要避免这种情况,可使用显式类型 cast, 例如:

SELECT CONCAT(CAST(int_col AS CHAR), char_col)

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