Re: very big problem with NULL

From: Rene Pijlman <reageer(dot)in(dot)de(dot)nieuwsgroep(at)onzin-adres(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: very big problem with NULL
Date: 2001-06-08 17:34:34
Message-ID: g132it43h7uc3se0hhcmed89993kbdk76a@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Grant <grant(at)xactcommerce(dot)com> schreef:
>However, the last time i checked, NULL does not equal to 1, 2, 3, or
>anything else besides NULL. Thats why I'm confused as to why SELECT column
>FROM table WHERE column != 1 also excludes NULL, because 1 does NOT have the
>same value as NULL.

NULL is unknown. Therefore, it is unknown if NULL equals 1, and it is
also unknown if NULL does not equal 1.

NULL = 1 --> NULL
NULL != 1 --> NULL

That's why SQL has the special operator IS NULL and IS NOT NULL (or
NOT IS NULL, I allways forget which one).

--
Vriendelijke groet,
René Pijlman <rpijlman(at)spamcop(dot)net>

Wat wil jij leren?
http://www.leren.nl/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Bartlett 2001-06-08 17:48:06 Re: maximum number of rows in table - what about oid limits?
Previous Message Tom Lane 2001-06-08 16:47:54 Re: [GENERAL] REPOST: redefining location of the socket file /tmp/.s.PGSQL.5432