PostgreSQL – Check value is in array

With PostgreSQL, if you have a field containing an Array and you want to get all the results containing this value in the array, you can use the following command.

Here, we are looking for all the results in the table my_table containing my_value in the field my_array.

SELECT * FROM my_table WHERE 'my_value'=ANY(my_array) ORDER BY id;

   id  |        type        |             title             |             my_array                                                            
-------+--------------------+-------------------------------+------------------------------------
 93646 | this_is_my_type    | this_is_my_title              | {my_1,my_2,my_3,my_value,my_4,my_5}
 94184 | this_is_my_type    | this_is_my_title2             | {my_3,my_value,my_4,my_5}
 98240 | this_is_my_type    | this_is_my_title3             | {my_1,my_2,my_3,my_value}