Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql queries the value of json

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the value of mysql query json, which has a certain reference value, friends who need can refer to it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

Mysql 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.

Mysql looks for a field in json

SELECT json_extract (field name,'$.json structure') FROM table name

If there are double quotation marks in the json, then the data taken out in this way is also in double quotation marks. To remove it, use the REPLACE function.

For example:

The data stored in the push_data field in the ps_push_data table are: {"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 support the operation of json data.

Thank you for reading this article carefully. I hope it is helpful for everyone to share the value of mysql query json. At the same time, I also hope you can support us, pay attention to the industry information channel, and find out if you have any problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report