How do I know what the SQL COUNT() will count?


#1

Link to exercise

I do not understand the following SQL code:

SELECT price, COUNT (*)
FROM fake_apps
GROUP BY price;

This code returns the price and the number of apps of that price. How does the code know to count the number of rows with the same price, as COUNT(*) returns the number of rows and there is no WHERE condition?


#2

* is a placeholder for any or all
it’s counting all / any prices

Means it’s looking at how many times any price is there in all prices -> if there is any price at least once it will be counted.