Re: very big problem with NULL - Mailing list pgsql-general

From missive@frontiernet.net (Lee Harr)
Subject Re: very big problem with NULL
Date
Msg-id 9fphns$181e$1@node21.cwnet.roc.gblx.net
Whole thread Raw
List pgsql-general
On Thu, 07 Jun 2001 19:11:21 -0400, Grant <grant@xactcommerce.com> wrote:
> ok.  i've found a weird bug.  I have five records in a table.  in one
> column i'm doing a select based on, two values for the column are NULL.
> i do a 'SELECT testcolumn FROM testtable WHERE testcolumn!=1'.  This
> query for some reason also excludes NULL, which does not make any sense
> considering NULL is not equal to 1, so the records with NULL in this
> column should be showing up as well.


The thing about NULL is ... you just don't know!

Maybe the column is number of children and sometimes when people
are entering data they forget to ask that question and so don't
enter that data (and you allow that, by not marking the column
NOT NULL) so some of the records have a "value" of NULL.

That does NOT mean that those people don't have 1 child.

Therefore, when you want those people which DEFINITELY DON'T
have 1 child, those records are not returned.

Now, if you want the records which don't have 1 child or which
you don't know how many children there are, you can do that.


pgsql-general by date:

Previous
From: John Scott
Date:
Subject: Re: [SQL] maximum number of rows in table - what about oid limits?
Next
From: "John Moo"
Date:
Subject: [newbie] Relations...