Re: Retrieving NULL records

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "psql novice" <psql_novice(at)operamail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Retrieving NULL records
Date: 2003-07-29 05:41:15
Message-ID: 18569.1059457275@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

"psql novice" <psql_novice(at)operamail(dot)com> writes:
> stock=> select * from stock where qty = NULL;

The correct incantation is

select * from stock where qty IS NULL;

Ordinary comparisons involving NULL always fail (or more accurately,
return NULL). You have to use the special "is null" operator instead.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message email 2003-07-29 06:40:03 Re: Retrieving NULL records
Previous Message psql novice 2003-07-29 05:33:40 Retrieving NULL records