IFNULL

IFNULL function returns the first not NULL input expression.

Syntax

IFNULL(expression1, expression2)

Description

Returns the first not NULL input expression.
  • Returns expression1 if expression1 is not NULL.

  • Returns expression2 if expression1 is NULL.

  • Returns NULL if both input expressions are NULL.

Example

  1. IFNULL(‘diff’, ‘same’)

    This example returns diff

  2. IFNULL(NULL, ‘same’)

    This example returns same.

  3. IFNULL(NULL, NULL)

    This example returns NULL