Multiple choice technology databases

which statement(s) does the following If @variable is NULL return '5', else return @variable

  1. ISNULL(@variable,'5')

  2. NULLIF(@variable,'5')

  3. COALESCE(@variable,'5')

  4. NONNULL(@variable,'5')

Reveal answer Fill a bubble to check yourself
A,C Correct answer
Explanation

ISNULL(@variable,'5') returns '5' when @variable is NULL, otherwise returns @variable itself. COALESCE(@variable,'5') does the same by returning the first non-NULL value from its arguments. NULLIF returns NULL if two values are equal - the opposite behavior needed here, and NONNULL is not a valid SQL function.