Can we also do count(name) instead of count(*)?

Hi, I am going over:https://www.codecademy.com/courses/learn-sql/projects/fakeapps
this is project and I am wondering about task 11: First, return the name of each category with the total number of companies that belong to it.
The hint use count (*) can I use count(name)? Like the following?

SELECT category,count(name)

From startups

GROUP BY category;

Have you tried? In this case I think you’ll get the same answer but it’s worth a quick check. It is always a good idea being careful in columns where NULLs are possible though as COUNT(*) includes NULLs and COUNT(column) does not (other functions may also act differently when encountering NULLs).

1 Like