gpt4 book ai didi

mysql - 如何使用 MYSQL 修改/追加表行?

转载 作者:行者123 更新时间:2023-11-28 23:28:50 26 4
gpt4 key购买 nike

我所知道的是,您可以在 MYSQL 中使用 concat 函数从查询附加值。

>col1 = ben

UPDATE table set col1 = concat(col1, ' altered')

>col1 = ben altered

但我想要实现的是在列的任何位置追加。

col1 = ben

UPDATE table set col1 = "altered " + col1
-- pseudo code

col1 = altered ben

mysql中有这个函数吗?

最佳答案

如果你想在列前添加,只需更改连接序列

UPDATE table set col1 =  concat('altered ' , col1 )

您可以使用您喜欢的所有列和值进行 se concat

 concat('altered ' , col1, ' altered')

concat('altered ' , col1, ' altered', col2, col3, 'altered again')

关于mysql - 如何使用 MYSQL 修改/追加表行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38127268/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com