I have a table in postgre SQL like this
which using 1 dimentional integer data type in array column
+----+--------+-----------+
| id | name | array |
+----+--------+-----------+
| 1 | apple | {1, 2, 3} |
| 2 | mango | {2, 3, 4} |
| 3 | banana | {4, 5, 6} |
+----+--------+-----------+
and I want to do a query to find every rows with array column contains at least one number from my list of number. For example, search each array to see if it contains 2, 4
Is there any better solution than using query like this?
SELECT * FROM table WHERE 2 = ANY (array) OR 4 = ANY (array)