当前位置:网站首页>Query JSON data in MySQL table
Query JSON data in MySQL table
2022-06-25 06:42:00 【Manon is by my side】
mysql Table query json data
// An highlighted block
Field attributes The value of is
{
“desc”: “{
“index”:“ Serial number ”, “startDate”:“ Start date ”, “endDate”:“ End date ”, “ruId”:“ Award rules ” }”, “name”: “ Date configuration ”, “tips”: “ Must match ”, “type”: “JSON”, “value”: “[{
“index”:1,“startDate”:“2022-02-15”,“endDate”:“2024-03-19”,“ruId”:“ru_4”}]”, “variable”: “date_config”, “configType”: “”}
1、 lookup desc, Use json_extract
select json_extract(attributes,’$.desc’) from TableName
if desc There are multiple elements under , You can use array subscripts ,desc[0]/desc[1] Take the corresponding element ; if desc The following contains multiple key value pairs , Then use desc.key Take corresponding key value
2、 Replacement available json_replace,json_set
Difference between the two
json_set() If found value exists, replace , Insert if it doesn't exist
json_replace() Replace / Modify existing values
Replace name Value
update TableName set name=json_set(attributes,’$.name’,‘ New value ’)
update TableName set name=json_replace(attributes,’$.name’,‘ New value ’)
select * from fa_trade_order WHERE json_extract(json,'$.status') ="1"
边栏推荐
- 集群常用群起脚本
- 3dmax软件的制作木桶过程:三步流程
- Can TCP syn handshake messages transmit data
- How do I turn off word wrap in iterm2- How to turn off word wrap in iTerm2?
- Unity获取资源路径
- JD 8 fleet stores search history, deletes history, clears history (not finished)
- SAP QM executes the transaction code qp01, and the system reports an error -material type food is not defined for task list type Q-
- Viewing Chinese science and technology from the Winter Olympics (V): the Internet of things
- Kubernetes core components etcd details
- Cs5092 5V USB input boost two section lithium battery charging management IC, SOT23-6 miniature package
猜你喜欢

DataX tutorial (10) - hot plug principle of dataX plug-in

What is VLAN

Are you still doing the dishes yourself? Teach you how to make dishwasher controller with single chip microcomputer

Laravel8+ wechat applet generates QR code

joda.time获取日期总结

Non-contact infrared temperature measurement system for human body based on single chip microcomputer

Ctfhub web - divulgation d'informations - traversée du Répertoire

How to realize the stable output of 3.3v/3.6v (1.2-5v) voltage of lithium battery by using the voltage rise and fall chip cs5517

Cannot activate inspection type when SAP retail uses transaction code mm41 to create commodity master data?

Understand what MSS is
随机推荐
Exercise: completion
Usage of STL map
ARM processor operating mode
这些老系统代码,是猪写的么?
Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution
Arm instructions and others
fastadmin 联级清空数据
了解zbrush雕刻软件,以及游戏建模的分析
Brief introduction and use of JSON
レレ / 蕾蕾
Understand what ICMP Protocol is
Derivation of sin (a+b) =sina*cosb+sinb*cosa
Acwing / 2004. Mauvaise écriture
JSON. toJSONString(object, SerializerFeature.WriteMapNullValue); Second parameter action
Missing libgmp-10 dll - libgmp-10. dll is missing
[short time energy] short time energy of speech signal based on MATLAB [including Matlab source code 1719]
Controlling volume mixer
Torchserve pit avoidance Guide
Understand ZBrush carving software and game modeling analysis
cos(a+b)=cosa*cosb-sina*sinb的推导过程