728x90
❓ Question
https://www.hackerrank.com/challenges/average-population-of-each-continent
❗ Answer
SELECT country.continent, FLOOR(AVG(city.population))
FROM city
INNER JOIN country
ON city.countrycode = country.code
GROUP BY country.continent;
📌 Discussion
- join 후 group by로 continent별로 묶고 avg 집계 후 floor로 버림
'SQL 문제풀이' 카테고리의 다른 글
[해커랭크 SQL] Aggregation - Revising Aggregations - Averages (0) | 2023.08.23 |
---|---|
[해커랭크 SQL] Aggregation - Revising Aggregations - The Sum Function (0) | 2023.08.23 |
[해커랭크 SQL] Basic Join - African Cities (0) | 2023.08.22 |
[해커랭크 SQL] Basic Join - Population Census (0) | 2023.08.22 |
[해커랭크 SQL] Advanced Select - The PADS (0) | 2023.08.22 |