表数据(member)
id | info |
---|---|
1 | {“id”:1,“name”:“swk”} |
2 | {“id”:2,“name”:“zbj”} |
3 | {“id”:3,“name”:“ss”} |
4 | {“id”:4,“name”:“ts”} |
例一,在field中使用
->在field中使用的时候结果带引号,->>的结果不带引号select info->"$.name" from member;
select info->>"$.name" from member;
例二,在where条件中使用
特别注意:->当做where查询是要注意类型的,->>是不用注意类型的select * from member where info->"$.id" = 1;
select * from member where info->"$.id" = "1";
select * from member where info->>"$.id" = 1;
select * from member where info->>"$.id" = "1";
例三,在order中使用
没有发现有什么区别select * from member order by info->"$.id" desc;
select * from member order by info->>"$.id" desc;