Revision
Comparisons with NULL
Functions with NULL
12. NULL with mathematical operators
COALESCE to the rescue
NULLIF
Revision 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 (column name new_price). Note what happens when there is no price.

Stuck? Here's a hint!

In order to give an alias, use the construction: column AS alias.

Console

Code editor

Result

TableConsole