Intermediate
Database Management Systems
Q80 / 100
What is the purpose of the COALESCE function in SQL?
Correct! Well done.
Incorrect.
The correct answer is C) To return the first non-NULL value from a list of expressions, commonly used to substitute default values for NULLs
C
Correct Answer
To return the first non-NULL value from a list of expressions, commonly used to substitute default values for NULLs
Explanation
COALESCE(phone, mobile, 'N/A') evaluates its arguments left to right and returns the first one that is not NULL. It is a portable, standard-SQL alternative to vendor-specific functions like ISNULL or NVL for handling missing data gracefully.
Progress
80/100