Introduction
The ISNULL() function
6. Using ISNULL() in the WHERE clause
The COALESCE() function
The NULLIF() function
Summary

Instruction

Fantastic! Let's do one more exercise before we move on. ISNULL() can also be used in the WHERE clause. Consider the following query:

SELECT
  Id,
  Category
FROM Product
WHERE ISNULL(Name, Category) LIKE N'H%' OR ISNULL(Name, Category) LIKE N'h%';

This returns product IDs and their categories, but only where the product name starts with H or h. If the name is NULL, we treat the category as a name.

Exercise

Show the IDs and categories of products that cost less than 100. If the price is unknown, assume it is 0.

Stuck? Here's a hint!

Use ISNULL().