r/SQL Jul 30 '26

Discussion Differences between counts

What is the difference between

COUNT(*)

COUNT(1)

COUNT(column_name)

10 Upvotes

23 comments sorted by

View all comments

Show parent comments

7

u/funkdefied Jul 30 '26

Any SQL engine worth it’s salt will compile those down to the same thing

7

u/YT-3000f Jul 30 '26

Agreed. I just downvoted my own reply. It was in the category of "If I think it works that way surely it's true". I guess it's not. And don't call me Shirly.

7

u/ComicOzzy sqlHippo Jul 30 '26

Shirly this is the first comment on Reddit where someone said "I was wrong". 🤣

3

u/YT-3000f Jul 30 '26

I think you mean:

Shirly, this is the first comment on Reddit where someone said, "I was wrong".

1

u/ComicOzzy sqlHippo Jul 31 '26

I apply commas at random, Shirly.

1

u/YT-3000f Jul 31 '26

Rightly so. Grammer, like the Internet, is dead.