select and null

Started by Peter Pilslover 25 years ago4 messagesgeneral
Jump to latest
#1Peter Pilsl
pilsl@goldfisch.at

I have a table and want to print out all entries that are not Null ...

select * from test;
entry
-------
1
2
3

(4 rows)

select * from test where entry=Null;
entry
-------

(1 row)

select * from test where entry<>Null;
entry
-------
(0 rows)

select * from test except select * from test where entry=Null;
entry
-------
(0 rows)

What is my brain missing here ???

thanks,
peter

--
mag. peter pilsl
email: pilsl@goldfisch.at
pgp-key available

#2Igor Roboul
igor@raduga.dyndns.org
In reply to: Peter Pilsl (#1)
Re: select and null

On Fri, Oct 27, 2000 at 02:17:23PM +0200, Peter Pilsl wrote:

select * from test where entry=Null;

select * from test where entry is not NULL;

or

select * from test where entry is NULL;

--
Igor Roboul, Unix System Administrator & Programmer @ sanatorium "Raduga",
Sochi, Russia
http://www.brainbench.com/transcript.jsp?pid=304744

#3Len Morgan
len-morgan@crcom.net
In reply to: Igor Roboul (#2)
Re: select and null

select * from test where entry NOT NULL ;

:-)
-----Original Message-----
From: Peter Pilsl <pilsl@goldfisch.at>
To: postgres mailinglist <pgsql-general@postgresql.org>
Date: Friday, October 27, 2000 7:41 AM
Subject: [GENERAL] select and null

Show quoted text

I have a table and want to print out all entries that are not Null ...

select * from test;
entry
-------
1
2
3

(4 rows)

select * from test where entry=Null;
entry
-------

(1 row)

select * from test where entry<>Null;
entry
-------
(0 rows)

select * from test except select * from test where entry=Null;
entry
-------
(0 rows)

What is my brain missing here ???

thanks,
peter

--
mag. peter pilsl
email: pilsl@goldfisch.at
pgp-key available

#4Marko Kreen
markokr@gmail.com
In reply to: Peter Pilsl (#1)
Re: select and null

On Fri, Oct 27, 2000 at 02:17:23PM +0200, Peter Pilsl wrote:

I have a table and want to print out all entries that are not Null ...

select * from test where entry=Null;

xxx = NULL -> answer is NULL, ofcourse.

You whould do ' ... WHERE entry IS NULL'

--
marko