【问题标题】:How to insert new parameter and update data JSON in mysql如何在mysql中插入新参数和更新数据JSON
【发布时间】:2023-01-12 12:53:29
【问题描述】:

[ { “dok_counter”:0, "dok_label": "标签 1", “dok_content_list”:“https://drive.google.com/” }, { “dok_counter”:1, "dok_label": "标签 2", “dok_content_list”:“https://drive.google.com/” } ]

使用 MYSQL 查询:

[ { “dok_counter”:0, "dok_label": "标签 1", “dok_content_list”:“https://drive.google.com/” }, { “dok_counter”:1, "dok_label": "标签 2", “dok_content_list”:“https://drive.google.com/” }, { “dok_counter”:2, "dok_label": "标签 3", “dok_content_list”:“https://drive.google.com/” } ]

【问题讨论】:

    标签: php mysql json


    【解决方案1】:

    要使用 MySQL 查询更新 JSON 数据,您首先需要将 JSON 数据存储在数据类型为 JSON 的 MySQL 列中。

    UPDATE table_name 
    SET json_data = JSON_INSERT(json_data, '$.dok_counter', 2, '$.dok_label', "Label 3", '$.dok_content_list', "https://drive.google.com/")
    

    【讨论】:

    • 我试试这个,但无法更新
    猜你喜欢
    • 2022-01-15
    • 2019-04-03
    • 2018-01-29
    • 1970-01-01
    • 2018-02-19
    • 2021-11-07
    • 2013-05-21
    • 2017-07-16
    • 2019-12-16
    相关资源
    最近更新 更多