January 2018
Intermediate to advanced
446 pages
12h 57m
English
You can modify the data using three different functions: JSON_SET(), JSON_INSERT(), JSON_REPLACE(). Before MySQL 8, we needed a full update of the entire column, which is not the optimal way:
mysql> UPDATE emp_details SET details = JSON_SET(details, "$.address.pin", "560100", "$.nickname", "kai")WHERE emp_no = 1;Query OK, 1 row affected (0.03 sec)Rows matched: 1 Changed: 1 Warnings: 0
Suppose you want to add a new column without updating the existing values; you can use JSON_INSERT():
mysql> UPDATE emp_details ...
Read now
Unlock full access