为此,请使用CONCAT()。让我们首先创建一个表-
create table DemoTable644 (Title text);
使用插入命令在表中插入一些记录-
insert into DemoTable644 values('Introduction'); insert into DemoTable644 values('Welcome in course');
使用select语句显示表中的所有记录-
select *from DemoTable644;
这将产生以下输出-
+-------------------+ | Title | +-------------------+ | Introduction | | Welcome in course | +-------------------+ 2 rows in set (0.00 sec)
这是将字符串连接为文本数据类型的查询-
update DemoTable644 set Title=concat(Title,' To MySQL'); Rows matched: 2 Changed: 2 Warnings: 0
让我们再次检查表记录-
select *from DemoTable644;
这将产生以下输出-
+----------------------------+ | Title | +----------------------------+ | Introduction To MySQL | | Welcome in course To MySQL | +----------------------------+ 2 rows in set (0.00 sec)