I have the following table structure here countries column is of array type.
id | name | countries
----+-------+-----------------------------------
1 | Asia | {india,china,pakistan,bangladesh}
2 | World | {india,pakistan,srilanka}
To find all rows of china or sriLanka
I use below query:
SELECT *
FROM country_list
WHERE 'china' = ANY(country_list.countries)
OR 'srilanka' = ANY(country_list.countries);
Can we have any better way to do this just like In operator?
Maybe something like, SELECT * FROM country_list WHERE name in ('Asia','World');?