Suppose that the "UnitsOnOrder" column is optional, and may contain NULL values.
Look at the following SELECT statement:
In the example above, if any of the "UnitsOnOrder" values are NULL, the result will be NULL.
The MySQL IFNULL() function lets you return an alternative value if an expression is NULL.
The example below returns 0 if the value is NULL:
Or we can use the COALESCE() function, like this: