提前致谢。假设,我有一个表,其中包含类似这样的数组中的值。
CREATE TABLE example (
id serial4 NOT NULL,
name varchar(100) NOT NULL,
content_type json NULL
CONSTRAINT example_pkey PRIMARY KEY (id)
);
id |name |content_type
-----------------------
1 | P | ['a','b','c']
2 | Q | ['a',]
3 | R | ['b','c']
4 | S | ['a','c']
我想查找'c'
content_type 中包含的行
我已经尝试过,但无法获得,
select * from table where ARRAY['c'] && content_type;
有人帮我建立查询吗?