I have started using MySQL 8
and trying to insert JSON data type
in a mysql table
My table t1
looks as below:
# id type jval
1100000 type1
I want to insert value for jval
which is of type JSON
.
UPDATE t1 mdata
SET mdata.jval = JSON_ARRAY_APPEND(jval, '$', JSON_OBJECT('user', 'user1', 'dept', 'dept1'))
WHERE mdata.type = 'type1';
The above query is not inserting value for jval
.
My table entry should look like below:
# id type jval
1100000 type1 [{"user": "user1", "dept": "dept1"}]