Hi,
How can I get the tuples one of whose attributes is NULL?
For example,
  First, create table tb(id int,name text);
  Then   insert into tb values(1); 
insert into tb values(2,'Rose');
  I want to select the tuples whose attribute name= NULL,
How to write the sql ?
Thanks.


Wed, 21 May 2003 16:10:23 +0800
zhangyue <postgresql@db.pku.edu.cn>
about NULL
On 21 May 2003 at 16:10, zhangyue wrote:

> Hi,
> How can I get the tuples one of whose attributes is NULL?
> For example,
>   First, create table tb(id int,name text);
>   Then   insert into tb values(1); 
> insert into tb values(2,'Rose');
>   I want to select the tuples whose attribute name= NULL,
> How to write the sql ?

select columns from table where attribute is null;

This should have been on postgresql-general, not on hackers..

HTH

Bye
 Shridhar

--
Fourth Law of Applied Terror:	The night before the English History mid-term, 
your Biology	instructor will assign 200 pages on planaria.Corollary:	Every 
instructor assumes that you have nothing else to do except	study for that 
instructor's course.


Wed, 21 May 2003 14:16:47 +0530
"Shridhar Daithankar" <shridhar_daithankar@persistent.co.in>
Re: [HACKERS] about NULL
> How can I get the tuples one of whose attributes is NULL?
> For example,
>   First, create table tb(id int,name text);
>   Then   insert into tb values(1); 
> insert into tb values(2,'Rose');
>   I want to select the tuples whose attribute name= NULL,
> How to write the sql ?

SELECT * FROM tb WHERE name IS NULL;

Chris


Wed, 21 May 2003 16:49:10 +0800
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au>
Re: about NULL
SELECT * FROM tb WHERE name IS NULL;

And I think it should have been on the SQL list, myself...

Shridhar Daithankar wrote:

>On 21 May 2003 at 16:10, zhangyue wrote:
>
>  
>
>>Hi,
>>How can I get the tuples one of whose attributes is NULL?
>>For example,
>>  First, create table tb(id int,name text);
>>  Then   insert into tb values(1); 
>>insert into tb values(2,'Rose');
>>  I want to select the tuples whose attribute name= NULL,
>>How to write the sql ?
>>    
>>
>
>select columns from table where attribute is null;
>
>This should have been on postgresql-general, not on hackers..
>
>HTH
>
>Bye
> Shridhar
>
>--
>Fourth Law of Applied Terror:	The night before the English History mid-term, 
>your Biology	instructor will assign 200 pages on planaria.Corollary:	Every 
>instructor assumes that you have nothing else to do except	study for that 
>instructor's course.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html
>  
>







SELECT * FROM tb WHERE name IS NULL;

And I think it should have been on the SQL list, myself...

Shridhar Daithankar wrote:

On 21 May 2003 at 16:10, zhangyue wrote:

  

Hi,
How can I get the tuples one of whose attributes is NULL?
For example,
  First, create table tb(id int,name text);
  Then   insert into tb values(1); 
insert into tb values(2,'Rose');
  I want to select the tuples whose attribute name= NULL,
How to write the sql ?
    


select columns from table where attribute is null;

This should have been on postgresql-general, not on hackers..

HTH

Bye
 Shridhar

--
Fourth Law of Applied Terror:	The night before the English History mid-term, 
your Biology	instructor will assign 200 pages on planaria.Corollary:	Every 
instructor assumes that you have nothing else to do except	study for that 
instructor's course.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html
Wed, 21 May 2003 11:12:32 -0500
DeJuan Jackson <djackson@speedfc.com>
Re: [HACKERS] about NULL
On Wednesday 21 May 2003 10:46, Shridhar Daithankar wrote:
> On 21 May 2003 at 16:10, zhangyue wrote:
> > Hi,
> > How can I get the tuples one of whose attributes is NULL?
> > For example,
> >   First, create table tb(id int,name text);
> >   Then   insert into tb values(1);
> > insert into tb values(2,'Rose');
> >   I want to select the tuples whose attribute name= NULL,
> > How to write the sql ?
>
> select columns from table where attribute is null;
>
> This should have been on postgresql-general, not on hackers..
>

SELECT * FROM tb WHERE name IS NULL;
or even 
SELECT * FROM tb WHERE name=NULL;
but the second one would work only if "transform_null_equals" is set to true 
in postgresql.conf



Wed, 21 May 2003 20:08:29 +0200
Darko Prenosil <darko.prenosil@finteh.hr>
Re: [HACKERS] about NULL