Answer: This COALESCE function is used to return a value which is the first non-null expression among all its arguments.
If all the arguments are NULL, in that case COALESCE will return NULL.
It is also used to display any other value instead of NULL value in the result.
Example:
SELECT Name, COALESCE(Business_Phone, Cell_Phone, Home_Phone) Contact_Phone
FROM Contact_Info;
Result:
Name Contact_Phone
Jeff 531-2531
Laura 772-5588
Peter 594-7477
Asked In: Many Interviews |
Alert Moderator