contains function

The contains function indicates whether or not a search string is present inside the source string.

returnvalue contains(source, search_string)

source ::= any*
search_string ::= any*
returnvalue ::= boolean

Example 1 - Fetch the full names of passengers who have “SFO” in their route.

SELECT fullname FROM baggageInfo bag
WHERE EXISTS bag.bagInfo[contains($element.routing,"SFO")]

Output:

{"fullname":"Michelle Payne"}
{"fullname":"Lucinda Beckman"}
{"fullname":"Henry Jenkins"}
{"fullname":"Lorenzo Phil"}
{"fullname":"Gerard Greene"}