Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JsToCode opened this issue Apr 4, 2021 · 0 comments
Open

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

JsToCode opened this issue Apr 4, 2021 · 0 comments

Comments

@JsToCode
Copy link

JsToCode commented Apr 4, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant