코딩테스트연습(SQL)
Average Population of Each Continent / HackerRank, SQL, MySQL
LearnerToRunner
2022. 12. 27. 18:46
문제
Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer.
Note: CITY.CountryCode and COUNTRY.Code are matching key columns.
제출답안(MySQL)
SELECT continent, FLOOR(AVG(ct.population))
FROM city as ct JOIN country ctr ON ct.countrycode = ctr.code
GROUP BY continent
문제 바로가기(MySQL)
728x90