Обсуждение: is NULL = NULL true or false?

Поиск
Список
Период
Сортировка

is NULL = NULL true or false?

От
"Gene Selkov, Jr."
Дата:
Hi,

I am joining two or more tables on the column that has quite a number
of nulls, assuming 'a.key = b.key' to be a valid expression even when
both operands are NULLs. The result set is way smaller that I
expect. Could that be because the two NULLs do not match?

I guess there are two possible ways to treat the NULL = NULL
problem. One is to say, "Don't know. There is no information to say
whether this is true or false". The second is to say, "Yes, these two
entities are the same. They are equally undetermined".

The function I want to achieve is:

'a.key = b.key' OR ((a.key IS NULL) AND (b.key IS NULL))

Isn't it the way it's wired?


--Gene