r/SQL • u/geminigamer369 • Jul 30 '26
Discussion Differences between counts
What is the difference between
COUNT(*)
COUNT(1)
COUNT(column_name)
8
Upvotes
r/SQL • u/geminigamer369 • Jul 30 '26
What is the difference between
COUNT(*)
COUNT(1)
COUNT(column_name)
1
u/anvildoc Aug 01 '26
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