I have a scenario where i need to select rows by matching the items present in one of the columns of the table,
My table looks like below,
create table Arraycheck
(
empnames text[],
age int
)
insert into Arraycheck (empnames,age) values ('{vin,vinod,hyv,bang}'::text[],12);
insert into Arraycheck (empnames,age) values ('{bangalore,bengaluru,bang}'::text[],13);
Case 1 : I want to select the rows whose empnames has 'vin' in it. I used the below query and it works fine.
SELECT * FROM Arraycheck WHERE 'vin' = ANY (empnames);
Case 2:
Now i want to select rows which has both 'vin' and 'bang'. I am unable to find query for this,
Can some one guide me here. I am using spring jdbctemplate. i need to use this query in spring jdbctemplate.