您好,欢迎来到喜迪情感。
搜索
您的当前位置:首页mysql json_extract

mysql json_extract

来源:喜迪情感


在mysql下的json_extract是怎样的呢?下面就让我们一起来了解一下吧:

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)

以上就是小编的分享了,希望能够帮助到大家。

Copyright © 2019- xdyj.cn 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务