当前位置:懂科普 >

IT科技

> mysql json extract

mysql json extract

json_extract()函数是属于mysql下的一个函数,可以用于查询json中某个字段的值。

基本的语法格式为:

JSON_EXTRACT(json_doc,path【,path】 …)

mysql json extract

说明:若是数据量不大,json字符串较大就能够采用该方法,若是数据量较大最好是不要使用。

mysql json extract 第2张

参考范例:

json_extract()函数的使用,示例代码

mysql> select json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.tel");+--------------------------------------------------------------+| json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.tel") |+--------------------------------------------------------------+| "13240133388"                                                |+--------------------------------------------------------------+1 row in set (0.00 sec)mysql> select json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.name");+---------------------------------------------------------------+| json_extract('{"name":"Zhaim","tel":"13240133388"}',"$.name") |+---------------------------------------------------------------+| "Zhaim"                                                       |+---------------------------------------------------------------+1 row in set (0.00 sec)
标签: extract mysql json
  • 文章版权属于文章作者所有,转载请注明 https://dongkepu.com/itkeji/jm379z.html