Retrieving NULL records

From: "psql novice" <psql_novice(at)operamail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Retrieving NULL records
Date: 2003-07-29 05:33:40
Message-ID: 20030729053340.16001.qmail@operamail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-07-29 05:41:15 Re: Retrieving NULL records
Previous Message David Choo 2003-07-29 02:25:35 Unable to start postmaster