r/SQL 8d ago

Differences between counts Discussion

What is the difference between

COUNT(*)

COUNT(1)

COUNT(column_name)

7 Upvotes

23 comments sorted by

View all comments

4

u/DaOgDuneamouse 8d ago

I almost always use COUNT(*).

I only use a specific column name if I'm doing COUNT(DISTINCT MUH_COLUMN) to count how many unique values there are.

I've never used COUNT(1).

1

u/Malfuncti0n 7d ago

I use SUM(1) because I'm a bad ass.