【发布时间】:2019-07-20 17:47:08
【问题描述】:
我在mysql数据库中有一个json字符串,如下所示。
{"name":"Georg","position":"Manager"}
我需要添加另一个属性,例如 "date_of_birth":"1989-06-08"
【问题讨论】:
标签: mysql json mysql-json
我在mysql数据库中有一个json字符串,如下所示。
{"name":"Georg","position":"Manager"}
我需要添加另一个属性,例如 "date_of_birth":"1989-06-08"
【问题讨论】:
标签: mysql json mysql-json
【讨论】:
您可以尝试在 json 字符串上使用 replace() 函数
select REPLACE ( column_name, "}", ', "date_of_birth":"1989-06-08"}')
from my_table
或更新表中的值
UPDATE my_table
SET column_name = REPLACE ( column_name, "}", ', "date_of_birth":"1989-06-08"}')
【讨论】: