網站首頁 學習教育 IT科技 金融知識 旅遊規劃 生活小知識 家鄉美食 養生小知識 健身運動 美容百科 遊戲知識 綜合知識
當前位置:趣知科普吧 > IT科技 > 

mysql json extract

欄目: IT科技 / 發佈於: / 人氣:2.17W

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)
Tags:json mysql extract