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: Nicolas Issakides <nissakid_at_planete.net>
Date: Tue, 05 May 1998 19:49:30 GMT
Message-ID: <354f6d4a.0@news.kampot.pci>

the answer is very simple :

count(*) will count the number of record. but take a loot

SQL> select * from toto;

C1 C2 C3
---------- ---------- ----------

c1         c2         c3
            c2         c3
                         c3

c1
c1         c2
c1                     c3
            c2         c3

8 rows selected.

SQL> select * from toto where c1 = 'c1';

C1 C2 C3
---------- ---------- ----------
c1 c2 c3
c1

c1         c2
c1                    c3

SQL> select * from toto where c1 != 'c1';

no rows selected

when you check for a value or not a value, rememver that NULL VALUES are NOT VALUES. So, there record are never 'A' and never <> 'A'

In article <roy-0505981118410001_at_qwerky.med.nyu.edu>, roy_at_popmail.med.nyu.edu (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
>

Nicolas

Nissakid_at_planete.net
Microsoft Certified Product Specialist
AUI Member

The above represents my own opinion not my employer's and does not necessarily constitute the official policy of my employer. Any opinion developed through this account represent a private conversation. Received on Tue May 05 1998 - 14:49:30 CDT

Original text of this message

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