Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Revision
Comparisons with NULL
9. NULL with operator IN
Functions with NULL
COALESCE to the rescue
NULLIF
Revision and practice

Instruction

Nice! Another place where NULL won't work is the construction IN(a,b,c, …). If you want to select those products which were introduced on Febuary 25, 2015 or August 1, 2015 or don't have a launch_date, you could think it's right to write the following:

SELECT *
FROM product
WHERE launch_date IN ('2015-02-25', '2015-08-01', NULL);


But this query is not correct. The proper way to do it is as follows:

SELECT *
FROM product
WHERE launch_date IN ('2015-02-25','2015-08-01')
OR launch_date IS NULL;


The second method requires more typing, but at least it will include NULL too.

Exercise

Select all the columns for products from categories: kitchen, bathroom, or with unknown category.

Stuck? Here's a hint!

In the WHERE clause, use the construction IN('option1', 'option2') and introduce a second condition joined with OR.