contains
Returns true if <expr1>
contains <expr2>
. Both expressions must be strings.
Syntax
Section titled “Syntax”contains( <expr1> , <expr2> )
Arguments
Section titled “Arguments”<expr1>
Section titled “<expr1>”The string to search in.
<expr2>
Section titled “<expr2>”The string to search for.
Returns
Section titled “Returns”Returns a boolean or NULL:
- Returns TRUE if
<expr2>
is found inside<expr1>
. - Returns FALSE if
<expr2>
is not found inside<expr1>
. - Returns NULL if either input expression is NULL.
Examples
Section titled “Examples”Determine whether column values contain a string:
VALUES ('coffee'), ('ice tea'), ('latte'), ('tea'), (NULL)WHERE contains($0, 'te');
+---------+| $0 |+---------+| ice tea || latte || tea |+---------+