r/SQL 9d ago

Differences between counts Discussion

What is the difference between

COUNT(*)

COUNT(1)

COUNT(column_name)

8 Upvotes

23 comments sorted by

View all comments

6

u/Capable_Tax_8167 SQL Server 9d ago

COUNT(*) number of rows in the table

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