Revision
Comparisons with NULL
8. NULL with comparisons
Functions with NULL
COALESCE to the rescue
NULLIF
Revision and practice

Instruction

Excellent! NULL is also tricky when it comes to comparisons. If you write a query like this:

SELECT *
FROM product
WHERE price > 0.99;

the rows with a NULL price will not be displayed at all. This is because the database doesn't know whether NULL > 0.99 is true or false, so it just skips such rows and doesn't bother.

Exercise

Mr Amund released a certain series of products on April 30, 2014. Now, he would like to get all the names, categories and types of those products which were introduced any time later or which will be introduced in the future (i.e. they don't have a launch_date yet). Write the proper query.

Stuck? Here's a hint!

You need two conditions in the WHERE clause, joined by OR. Remember to put the date in apostrophes, in the format 'YYYY-MM-DD'.

Console

Code editor

Result

TableConsole