Re: very big problem with NULL

From: missive(at)frontiernet(dot)net (Lee Harr)
To: pgsql-general(at)postgresql(dot)org
Subject: Re: very big problem with NULL
Date: 2001-06-08 03:45:01
Message-ID: 9fphns$181e$1@node21.cwnet.roc.gblx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 07 Jun 2001 19:11:21 -0400, Grant <grant(at)xactcommerce(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Namrata 2001-06-08 05:00:18 Maximum Limit of the database for no. of records.
Previous Message Steven D. Arnold 2001-06-08 02:23:00 plpython and trusted modules