當前位置:生活全書館 >

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)
標籤: json mysql extract
  • 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/0wr6mg.html