Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: The use of COUNT(*)
A copy of this was sent to doid <doid_at_usa.net>
(if that email address didn't require changing)
On Fri, 10 Jul 1998 18:04:00 GMT, you wrote:
>Been there:)
>
>1) count(*) won't count nulls. this can screw up your logic
>sometimes...anyway, it's much more efficent to count( <some indexed column> )
>or count(1)
>
no thats backwards, count(*) counts nulls -- its count(<some indexed column>) -- actually count(any column) -- that won't.....
SQL> create table demo ( x int );
Table created.
SQL> create index demo_x_idx on demo(x); Index created.
SQL> insert into demo values ( null );
1 row created.
SQL> select count(*) from demo;
COUNT(*)
1
SQL> select count(x) from demo;
COUNT(X)
0
[snip]
>
>doid
>
>
>
>
>Lai King Leung wrote:
>
>> Could anyone tell me about the use of COUNT(*)?
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA
http://govt.us.oracle.com/ -- downloadable utilities
Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Fri Jul 10 1998 - 13:49:43 CDT
![]() |
![]() |