Bird
0
0

What does the SQL function COALESCE do?

easy📝 Conceptual Q11 of 15
SQL - CASE Expressions
What does the SQL function COALESCE do?
AReturns the first non-NULL value from its arguments
BReturns NULL if two values are equal
CAlways returns the last value in the list
DConverts NULL values to zero
Step-by-Step Solution
Solution:
  1. Step 1: Understand COALESCE behavior

    COALESCE checks each argument in order and returns the first one that is not NULL.
  2. Step 2: Compare with other options

    NULLIF returns NULL if two values are equal, which is different. COALESCE does not convert NULL to zero automatically.
  3. Final Answer:

    Returns the first non-NULL value from its arguments -> Option A
  4. Quick Check:

    COALESCE = first non-NULL [OK]
Quick Trick: COALESCE picks first non-NULL value in order [OK]
Common Mistakes:
  • Confusing COALESCE with NULLIF
  • Thinking COALESCE converts NULL to zero
  • Assuming COALESCE returns last value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes