We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'm new in MySQL, but what is the difference between these two options, both give me correct results:
In the first one I haven't used JOIN but in the second I have used it.
SELECT COUNTRY.continent, FLOOR(AVG(CITY.population)) FROM CITY, COUNTRY WHERE CITY.countrycode = COUNTRY.code AND CITY.NAME IS NOT NULL GROUP BY COUNTRY.continent;
SELECT COUNTRY.continent, FLOOR(AVG(CITY.population)) FROM CITY JOIN COUNTRY ON CITY.countrycode = COUNTRY.code WHERE CITY.NAME IS NOT NULL GROUP BY COUNTRY.continent;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Average Population of Each Continent
You are viewing a single comment's thread. Return to all comments →
I'm new in MySQL, but what is the difference between these two options, both give me correct results: In the first one I haven't used JOIN but in the second I have used it.
SELECT COUNTRY.continent, FLOOR(AVG(CITY.population)) FROM CITY, COUNTRY WHERE CITY.countrycode = COUNTRY.code AND CITY.NAME IS NOT NULL GROUP BY COUNTRY.continent;
SELECT COUNTRY.continent, FLOOR(AVG(CITY.population)) FROM CITY JOIN COUNTRY ON CITY.countrycode = COUNTRY.code WHERE CITY.NAME IS NOT NULL GROUP BY COUNTRY.continent;