当前位置:网站首页>mysql 表查询json数据
mysql 表查询json数据
2022-06-25 06:32:00 【码农竟在我身边】
mysql 表查询json数据
// An highlighted block
字段attributes的值为
{
“desc”: “{
“index”:“序号”, “startDate”:“开始日期”, “endDate”:“结束日期”, “ruId”:“发奖规则” }”, “name”: “日期配置”, “tips”: “必配”, “type”: “JSON”, “value”: “[{
“index”:1,“startDate”:“2022-02-15”,“endDate”:“2024-03-19”,“ruId”:“ru_4”}]”, “variable”: “date_config”, “configType”: “”}
1、查找desc,使用json_extract
select json_extract(attributes,’$.desc’) from TableName
若desc下有多个元素,可使用数组下标,desc[0]/desc[1]取对应元素;若desc下包含多个键值对,则使用desc.key取对应key值
2、替换可使用json_replace,json_set
二者区别
json_set() 若查找的值存在则替换,不存在则插入
json_replace()替换/修改存在的值
替换name的值
update TableName set name=json_set(attributes,’$.name’,‘新的值’)
update TableName set name=json_replace(attributes,’$.name’,‘新的值’)
select * from fa_trade_order WHERE json_extract(json,'$.status') ="1"
边栏推荐
- Is the number of indexes in a table the more the better?
- 2022-02-19: fence installation. In a two-dimensional garden, there are some trees represented by (x, y) coordinates. As the installation cost is very expensive, your task is to enclose all the trees w
- How to realize hierarchical management of application and hardware in embedded projects
- TCP BBR as rate based
- We cannot activate inspection type for article master in transaction code MM41?
- Arm register (cortex-a), coprocessor and pipeline
- DataX tutorial (10) - hot plug principle of dataX plug-in
- Research Report on investment share and application prospect of 1,3-propanediol (PDO) industry in the world and China 2022
- Research Report on demand and Competitive Prospect of global and Chinese welding personal protective equipment industry 2022-2027
- 3-7sql injection website instance step 3: attack type and attack strategy
猜你喜欢

How two hosts in different network segments directly connected communicate

Cs5092 5V USB input boost two section lithium battery charging management IC, SOT23-6 miniature package

Wan Yin revealed that he was rejected by MIT in this way: "the department doesn't like you". He confronted the principal and realized

Socket, network model notes

Query process of MySQL secondary index

Ht8513 single lithium battery power supply with built-in Dynamic Synchronous Boost 5W mono audio power amplifier IC solution

Viewing Chinese science and technology from the Winter Olympics (V): the Internet of things
![[short time average zero crossing rate] short time average zero crossing rate of speech signal based on MATLAB [including Matlab source code 1721]](/img/4a/304f262c1c08800aa95f9e2d537e4d.jpg)
[short time average zero crossing rate] short time average zero crossing rate of speech signal based on MATLAB [including Matlab source code 1721]

Guess the size of the number

Microsoft issued a document to celebrate Net 20th anniversary!
随机推荐
Single lithium battery 3.7V power supply 2x12w stereo boost audio power amplifier IC combination solution
Cs5092 5V USB input boost two section lithium battery charging management IC, SOT23-6 miniature package
DNS domain name system
What elements are indispensable for the development of the character? What are the stages
Cs4344/ht5010 stereo d/a digital to analog converter
Observation configuring wmic
Metauniverse in 2022: robbing people, burning money and breaking through the experience boundary
In depth inventory: 23 vscode plug-in artifacts that improve development efficiency and aesthetics
Why study discrete mathematics
At the age of 26, I was transferred to software testing with zero foundation. Now I have successfully entered the job with a monthly salary of 12K. However, no one understands my bitterness
Explain @builder usage
Investment opportunities and operational risk assessment report of China's engineering consulting industry during the 14th Five Year Plan period 2022-2028
Cs8683 (120W mono class D power amplifier IC)
@Detailed explanation of valid annotation usage
How do I check swift if two arrays contain the same elements, regardless of the order in which they appear?
Face++ realizes face detection by flow
Research Report on demand and Competitive Prospect of global and Chinese welding personal protective equipment industry 2022-2027
Es11 new methods: dynamic import(), bigint, globalthis, optional chain, and null value merging operator
Research Report on brand strategic management and marketing trends in the global and Chinese preserved fruit market 2022
How to realize hierarchical management of application and hardware in embedded projects