Retrieving NULL records

Поиск
Список
Период
Сортировка
От psql novice
Тема Retrieving NULL records
Дата
Msg-id 20030729053340.16001.qmail@operamail.com
обсуждение исходный текст
Ответы Re: Retrieving NULL records  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: String manipulation
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Retrieving NULL records