create
CREATE TABLE `t_test` (
`salary_data` json NULL COMMENT 'JSON类型字段'
);
insert
INSERT INTO t_test(salary_data) VALUES('{"param_1": "111","param_2": "222","param_3": "333","param_4": "444"}');
INSERT INTO t_test(salary_data) VALUES('{"param_1": "xxx","param_2": "yyy","param_3": "333","param_4": 444}');
select -> json_keys
SELECT json_keys(salary_data) from t_test;
select -> one param
SELECT salary_data->'$.param_4' FROM t_test;
select -> json_object
select salary_data from t_test;
select -> where
SELECT salary_data->'$.param_4' FROM t_test where salary_data->'$.param_4'='444';
SELECT salary_data->'$.param_4' FROM t_test where salary_data->'$.param_4'=444;
SELECT salary_data->'$.param_4' FROM t_test where JSON_CONTAINS(salary_data, '"444"', '$.param_4');
SELECT salary_data->'$.param_4' FROM t_test where JSON_CONTAINS(salary_data, '444', '$.param_4');
update -> json_insert
UPDATE t_test SET salary_data = json_insert(salary_data, '$.param_5', 555, '$.param_6', 666) WHERE salary_data->'$.param_1'= 'xxx';
update -> json_set
UPDATE t_test SET salary_data = json_set(salary_data, '$.param_2', 222, '$.param_3', 333) WHERE salary_data->'$.param_1'= '111';
update -> json_remove
UPDATE t_test SET salary_data = json_remove(salary_data, '$.param_5', '$.param_6') WHERE salary_data->'$.param_1'= 'xxx';