SELECT continent, COUNT(name)
FROM world
WHERE population>200000000
GROUP BY continent
When i execute the query above the query runs fine. It basically shows the number of countries in each continent that has a population larger than 200000000.
However when I modify my query to the below :
SELECT DISTINCT(continent), COUNT(name)
FROM world
WHERE population>200000000
This does not work. I am wondering what the reason is. In this case I am saying for each distinct continent count the total countries with population larger than 200000000.
I just want to understand the reasoning so i can become better at writing queries.