IT科技

當前位置 /首頁/IT科技 > /列表

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)
TAG標籤:json extract mysql #