Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Review
Comparisons with NULL
Functions with NULL
12. NULL with mathematical operators
COALESCE to the rescue
NULLIF
Review and practice

Instruction

Perfect! As you can see, we got a NULL when one of the concatenated columns was a NULL.

The same goes for mathematical operators: +, -, *, /. Adding a NULL value to something will return NULL. Similarly, multiplying two values, of which one is NULL, will always return NULL.

Exercise

A new tax has been imposed on all the products, which is 2% of the final price. Show all product names with their old price (column name old_price) and new price rounded to two decimal points (column name new_price). Note what happens when there is no price.

Stuck? Here's a hint!

To round x to two decimal points, you can use the ROUND() function in the following way:

ROUND(x, 2)