Multiple choice technology databases

COALESCE (A,B)is equivalent to?

  1. CASE WHEN B IS NOT NULL THEN A ELSE B

  2. CASE WHEN A IS NOT NULL THEN A ELSE B

  3. CASE WHEN A IS NOT NULL THEN B ELSE A

  4. CASE WHEN A IS NOT NULL THEN A ELSE A

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

COALESCE returns the first non-null expression in the list. COALESCE(A, B) is logically identical to a CASE statement that checks if A is NOT NULL; if so, it returns A, otherwise it returns B.