In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article Xiaobian introduces in detail "JSON string instance analysis stored in Mysql", the content is detailed, the steps are clear, and the details are handled properly. I hope this article "JSON string instance analysis stored in Mysql" can help you solve your doubts.
Preface
JSON can convert a set of data represented in a JavaScript object into a string, which can then be easily passed between functions or from a Web client to a server-side program in an asynchronous application. This string can represent arrays and complex objects, not just a simple list of keys and values. Storing Json strings in Mysql can greatly simplify the complexity of storage. At the same time, reading the database has become the first problem encountered by many people.
Example: {"key": "value"}
What is Json?
JSON (JavaScript Object Notation) is a lightweight data exchange format. JSON uses a completely language-independent text format, which makes JSON an ideal language for data exchange. It is easy for people to read and write, and it is also easy for machine parsing and generation.
Second, different situations 1. Fuzzy query json type field
Stored data format (field name people_json):
{"name": "zhangsan", "age": "13", "gender": "male"}
The code is as follows (example):
Select * from table_name where people_json- >'$.name 'like'% zhang%'2. Query json type fields precisely
Stored data format (field name people_json):
{"name": "zhangsan", "age": "13", "gender": "male"}
The code is as follows (example):
Select * from table_name where people_json- >'$.age'= 133. Fuzzy query JsonArray type field
Stored data format (field name people_json):
[{"name": "zhangsan", "age": "13", "gender": "male"}]
The code is as follows (example):
Select * from table_name where people_json- >'$[*] .name 'like'% zhang%'4. Query JsonArray type fields precisely
Stored data format (field name people_json):
[{"name": "zhangsan", "age": "13", "gender": "male"}]
The code is as follows (example):
Select * from table_name where JSON_CONTAINS (people_json,JSON_OBJECT ('age', "13")) read here, this article "JSON string instance Analysis stored in Mysql" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it before you can understand it. If you want to know more about related articles, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.