I have a table with a jsonb data column, which looks like this:
data: {
"categories": [
"Category A",
"Category D"
],
"something": "dsa",
}
I would like to query rows that have one or more strings existing inside categories array (not empty intersection).
Let's suppose these strings to check against are "Category A" and "Category B".
How would such query look like?
Here's a query that does similar thing except it checks for all supplied strings to be existing in categories array:
SELECT *
FROM table
WHERE data->'categories' @> '["Category A", "Category B"]'
I need this query to match at least one string, not all.