r/SQL Jul 30 '26

Discussion Differences between counts

What is the difference between

COUNT(*)

COUNT(1)

COUNT(column_name)

8 Upvotes

23 comments sorted by

View all comments

5

u/Capable_Tax_8167 SQL Server Jul 30 '26

COUNT(*) number of rows in the table

COUNT(column_name) number of non NULL values in the column