Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
The ISNULL() function
The COALESCE() function
8. Data types in COALESCE ()
The NULLIF() function
Summary

Instruction

Excellent. Keep in mind, though, that the data type of the expression and the data type of the replacement must be the same. For instance, you can't write the following:

SELECT
  COALESCE(Price, N'unknown') AS Price
FROM Product;

The Price column is a decimal data type, but N'unknown' is a string. This will return an error. Instead, you'd need to use a decimal data type value for the NULL replacement.

Exercise

Run the template query. What will happen?

When you're done, click the Next exercise button.

Stuck? Here's a hint!

No, it's not a typo. This example purposely contains an error.