Skip to content

count(*) should be different from count(column)  #85

@JsToCode

Description

@JsToCode

I use cosette online to prove the count projection equivalence. The answer should be not equivalent. Because count(*) will include NULL value, while count(column) will exclude NULL value.
The following is the code:

schema s(a:int, b:int);
table r(s);
query q1 -- define query q1
select count(*) as a from r x;

query q2 -- define query q2 likewise
select count(y.b) from r y;

verify q1 q2;

count
There should be not equivalent if there exist some NULL values in y.b column. Even the int type, we can still set default value to NULL, not 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions