In SQL, what's the difference between count(column) and count(*)?
- by Bill the Lizard
I have the following query:
select column_name, count(column_name)
from table
group by column_name
having count(column_name) > 1;
What would be the difference if I replaced all calls to count(column_name) to count(*)?
This question was inspired by a previous one.
Edit:
To clarify the accepted answer (and maybe my question), using count(*) in this case returns an extra row in the result that contains a null and the count of null values in the column.