> Jean-Christian Imbeault wrote:
>
>> Why is it that "select null + 1" gives null but "select sum(a) from
>> table" where there are null entries returns an integer?
>>
>> Shouldn't the sum() and "+" operators behave the same?
> SQL92 (6.5 <set function specification>):
> 1) Case:
> a) If COUNT(*) is specified, then the result is the cardinality of T.
> b) Otherwise, ...
> So ...
> CREATE TABLE foo (value integer);
> INSERT INTO foo VALUES (NULL);
> INSERT INTO foo VALUES (3);
> Compare:
> SELECT COUNT(*) FROM foo;
> vs.
> SELECT COUNT(value) FROM foo;
Interesting. Thanks for pointing that out. I hadn't thought about the
fact that, e.g.,
SELECT count(*), count(last_name), count(middle_name) FROM person
would produce
430, 430, 186
~Berend Tober