Documentation

    contains

    Check whether text contains a search string. It also checks a list for an item, a map for a key and an unnamed struct for a value.

    Try an expression

    In Formula, enter the expression and set Output type to BOOLEAN.

    Example input

    1. Row 1name = 'Ada Lovelace'
    2. Row 2name = 'Lin Chen'
    3. Row 3name = NULL

    Expression

    contains(name, 'Ada')

    Result

    Row 1: true
    Row 2: false
    Row 3: NULL

    NULL means the value is missing.

    This Boolean expression also works in Filter custom mode. The True output receives rows 1; the False output receives rows 2, 3. A missing result goes to False.

    Arguments and types

    contains(value, search)
    string
    Text
    search_string
    Text

    The result type can depend on the input types. See DuckDB for the full argument rules.

    Things to know

    If the first argument is missing, the result is NULL.

    Browse textDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.