Documentation

    if

    Choose between two values using a condition.

    Try an expression

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

    Expression

    if(2 > 1, 'yes', 'no')

    Result

    'yes'

    To use your own data, replace the example values with column names. Keep format strings and other options as written.

    Arguments and types

    if(a, b, c)

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

    Things to know

    A missing condition

    if(NULL::BOOLEAN, 'yes', 'no')

    'no'

    Browse conditions & missing valuesDuckDB documentation

    Function metadata from DuckDB, used under the MIT license.