Retrieving NULL records - Mailing list pgsql-novice

From psql novice
Subject Retrieving NULL records
Date
Msg-id 20030729053340.16001.qmail@operamail.com
Whole thread Raw
Responses Re: Retrieving NULL records  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi,

How would you retrieve records containing NULL values?

Lets say you have a table called stock:

stock=> \d stock
                                      Table "public.stock"
  Column  |         Type          |                          Modifiers
----------+-----------------------+-------------------------------------------------------------
 stock_id | integer               | not null default nextval('public.stock_stock_id_seq'::text)
 name     | character varying(20) | not null
 qty      | integer               |

it contains the following records:

stock=> select * from stock;
 stock_id |   name    | qty
----------+-----------+-----
        1 | Chair     |  10
        2 | Desk      |  10
        3 | Phone     |  10
        4 | Chalk     |
        5 | Projector |
(5 rows)

So what i want to do is retrieve 'Chalk' and 'Projector';

Ive tried this but it didnt work.

stock=> select * from stock where qty = NULL;
 stock_id | name | qty
----------+------+-----
(0 rows)


Any help would be appreciated.

Thanks in advance
--
____________________________________________
http://www.operamail.com
Get OperaMail Premium today - USD 29.99/year


Powered by Outblaze

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: String manipulation
Next
From: Tom Lane
Date:
Subject: Re: Retrieving NULL records