Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Either it's equal or it isn't, right?

Re: Either it's equal or it isn't, right?

From: James Petts <jpetts_at_celltech.co.uk>
Date: Tue, 05 May 1998 17:12:44 +0100
Message-ID: <354F3A7C.9015310B@celltech.co.uk>


The other possibility is that the record has a NULL value in the field. Recall that NULL is never equal and never not equal to anything. If you do a

SELECT count(*) FROM phone WHERE record_status IS NULL

I suspect you will get 13042 - 12983 = 59 returned.

Roy Smith wrote:
>
> I'm really stumped by the following three queries. The first says there
> are N1 records in the table. The second says N2 of them have a given
> value. Therefore, shouldn't the number of records which don't have the
> value be equal to N1-N2? Either record_status is 'A' or it isn't 'A'.
> What other possibilities exist?
>
> SQL> select count(*) from phone;
>
> COUNT(*)
> ----------
> 13042
>
> SQL> select count(*) from phone where record_status = 'A';
>
> COUNT(*)
> ----------
> 12983
>
> SQL> select count(*) from phone where record_status != 'A';
>
> COUNT(*)
> ----------
> 0
Received on Tue May 05 1998 - 11:12:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US