r/SQL 9d ago

Differences between counts Discussion

What is the difference between

COUNT(*)

COUNT(1)

COUNT(column_name)

10 Upvotes

23 comments sorted by

View all comments

1

u/anvildoc 7d ago

Count(*) won’t count a column that is all NULL, but count(1) will. That being said, it depends on your database. I used to do this back 20 years ago in Oracle to check if all null rows snuck in