mysql json extract
- IT科技
- 關注:2.15W次
json_extract()函式是屬於mysql下的一個函式,可以用於查詢json中某個欄位的值。
基本的語法格式為:
JSON_EXTRACT(json_doc,path【,path】 …)
說明:若是資料量不大,json字元串較大就能夠採用該方法,若是資料量較大最好是不要使用。
參考範例:
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)
- 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/dianzi/0wr6mg.html