怎样在小程序里实现标题的更改
638
2022-10-12
PG jsonb 实例
实例1
truncate test;create table test(id int, json_data jsonb);insert into test values(1, '[{"user_name":"admin02"},{"user_name":"admin03"},{"user_name":"admin04"}]');insert into test values(2, '[{"user_name":"admin05"},{"user_name":"admin03"},{"user_name":"admin04"}]');select * from test where json_data::jsonb @> '[{"user_name":"admin02"}]'::jsonb;select * from test where json_data @> '[{"user_name":"admin02"}]' OR json_data @> '[{"user_name":"admin03"}]';
实际操作演示:
test=# select * from test where json_data @> '[{"user_name":"admin02"}]'; id | json_data----+-------------------------------------------------------------------------------- 1 | [{"user_name": "admin02"}, {"user_name": "admin03"}, {"user_name": "admin04"}]test=# select * from test where json_data @> '[{"user_name":"admin02"}]' OR json_data @> '[{"user_name":"admin03"}]'; id | json_data----+--------------------------------------------------------------------------- 1 | [{"user_name": "admin02"}, {"user_name": "admin03"}, {"user_name": "admin04"}] 2 | [{"user_name": "admin05"}, {"user_name": "admin03"}, {"user_name": "admin04"}](2 rows)
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~