I have the following SQL script:
CREATE temporary table if not EXISTS the_values (
key SERIAL,
value INTEGER NULL
);
insert into the_values(value) values (null),(1),(null),(2),(3),(4),(5),(6),(10),(null),(null);
select *
from the_values
where value not in (1,2,3,4,5,6,10);
And I noticed that the query:
select *
from the_values
where value not in (1,2,3,4,5,6,10);
Does not return the rows having value
NULL, and that caught my attention. Therefore, I want to know why that happens. I am interested more about the technical aspect of this phenomenon rather that the obvious solution:
select *
from the_values
where value not in (1,2,3,4,5,6,10)
or value IS NULL;
values is null or not in (...