Mysql method to query the value of json: first open the command window; then execute the SQL statement "SELECT REPLACE(json_extract(push_data,'$.carRenewalInfoVo.licence')..." to query the value of json .
Recommended: "mysql video tutorial"
mysql finds a certain field in json
SELECT json_extract(字段名,'$.json结构') FROM 表名;
If there are double quotes in json, then the data taken out in this way will also have double quotes. To remove it, use the REPLACE function
For example:
ps_push_data table The data stored in the push_data field is: {"carRenewalInfoVo":{"licence":"Zhejiang AF55Z0"},"code":"1","msg":"success"}
Use sql
SELECT REPLACE(json_extract(push_data,'$.carRenewalInfoVo.licence'),'"','') FROM ps_push_data;
What is taken out is: Zhejiang AF55Z0
It is worth noting that only MySQL5.7 and above versions support the operation of json data
The above is the detailed content of How to query the value of json in mysql. For more information, please follow other related articles on the PHP Chinese website!