Check comma separated string in comma separated column in postgresql

Dee*_*ran 2 sql postgresql

I have a string searchval = "php,java,html".

I want to check any of the comma separated value in string exist in column keyword in my below table.

My table

id     keyword
-----------------------------
1      java,php
2      jquery, javascript
3      java
4      php,jquery
Run Code Online (Sandbox Code Playgroud)

Any of the searchval(comma separated) value match the keyword(comma separated) should return the id.

So the result should be:

1 (java,php is there),
3 (java is there),
4 (php is there)
Run Code Online (Sandbox Code Playgroud)

How can I do this?

a_h*_*ame 6

You can easily convert a comma separated list into an array, then use Postgres' array functions to test for containment:

select id
from the_table
where string_to_array(keyword,',') && array['php','java','html'];
Run Code Online (Sandbox Code Playgroud)

The overlaps operator && checks if the array created from the keyword list contains elements from the array on the right hand side.

Online example: http://rextester.com/VNWP17762