I had a json string in mysql database like following.
{"name":"Georg","position":"Manager"}
I need to add another attribute like "date_of_birth":"1989-06-08"
I had a json string in mysql database like following.
{"name":"Georg","position":"Manager"}
I need to add another attribute like "date_of_birth":"1989-06-08"
You can also use JSON_INSERT function:
SELECT JSON_INSERT(@`json`, '$.date_of_birth', '1989-06-08');
See dbfiddle.
You could try using a replace() function on the json string
select REPLACE ( column_name, "}", ', "date_of_birth":"1989-06-08"}')
from my_table
or for update the value in you table
UPDATE my_table
SET column_name = REPLACE ( column_name, "}", ', "date_of_birth":"1989-06-08"}')