I have table with a column of jsons that have example value:
{"name": "1", "list": ["abc", "xyz"]}
{"name": "2", "list": ["b", "bc", "bcd"]}
{"name": "3", "list": ["cd", "cdef", "def", "defg", "ef"]}
I also have a array of (sub)strings that I want to keep in the array, for example:
["a","bc","def"]
(in my reality, about 20 strings)
How do I update the table so that only elements of the list that contain at least one of the strings remain?
expected result:
{"name": "1", "list": ["abc"]}
{"name": "2", "list": ["bc", "bcd"]}
{"name": "3", "list": ["cdef", "def", "defg"]}
honestly, i have no clue where to even begin, or even if it's possible in sql with its json functions.