# 得到"tom"select json_extract(content,'$.name') from test_json where id = 1;# 简写方式:字段名->表达式等价于json_extract(字段名,表达式)select content->'$.name' from test_json where id = 1;# 结果:+---+| json_extract(content,'$.name') |+---+| "tom" |+---++---+| conten...
例如: sql SELECT json_unquote(JSON_EXTRACT(json_column, '$.info.color')) AS color FROM t_table; 或者简写为: sql SELECT json_column->>'$.info.color' AS color FROM t_table; 这两种方式都可以去除提取结果中的双引号。
# 得到"tom"selectjson_extract(content,'$.name')fromtest_jsonwhereid=1; # 简写方式:字段名->表达式等价于json_extract(字段名,表达式)selectcontent->'$.name'fromtest_jsonwhereid=1; # 结果:+---+|json_extract(content,'$.name')|+---+|"tom"|+---++---+|content->'$.name'|+---+|"...
select json_unquote(json_extract(content,'$.name')) from test_json where id = 1; # 简写方式:字段名->>表达式等价于json_unquote(json_extract(字段名,表达式)) select content->>'$.name' from test_json where id = 1; # 结果: +---+ | json_unquote(json_extract(content,'$.name')) | ...