Subject | Re: [firebird-support] * vs fieldname |
---|---|
Author | Martijn Tonies |
Post date | 2007-09-13T13:53:07Z |
> Is there any time where there is an effective difference between:There's actually a functional difference!
>
> select count(*) from ...
>
> and
>
> select count(myfieldname) from ...
Try this:
CREATE TABLE COUNTED
(
PKCOL INTEGER NOT NULL,
VAL INTEGER,
CONSTRAINT PK_COUNTED PRIMARY KEY (PKCOL)
);
commit;
insert into counted values (1, 1);
insert into counted values (2, NULL);
commit;
select count(val)
from counted
returns 1
while
select count(*)
from counted
returns 2.
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com