| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 개발자_조이킴
- node.js
- 정규표현식
- 역행자
- JavaScript
- 프로그래머스
- Programmers
- for문
- 코플릿
- MySQL
- array
- 자바스크립트
- Hackerrank
- array.push()
- 코딩테스트
- 블록체인
- 알고리즘
- 최강의 인생
- 개발자의 책장
- array.slice()
- 코드스테이츠
- Developer_JoyKim
- Algorithms
- 재귀함수
- join
- SQL
- select
- 코딩공부
- 배열
- Where
Archives
- Today
- Total
CodingSpace
[HackerRank/SQL] Basic Join - Average Population of Each Continent 본문
HackerRank/SQL
[HackerRank/SQL] Basic Join - Average Population of Each Continent
개발자_조이킴 2022. 6. 8. 23:45Problem. Basic Join - Average Population of Each Continent
Link.
Average Population of Each Continent | HackerRank
Query the names of all continents and their respective city populations, rounded down to the nearest integer.
www.hackerrank.com
Description.
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.
CITY, COUNTRY 테이블을 사용하여 모든 CONTINENT의 이름과 CONTINENT 별 평균인구를 조회하는 쿼리문을 작성하시오.
※ 단, 평균인구 소숫점은 버림(rounded down) 처리하시오.


Key Point.
AVG,
FLOOR,
JOIN,
GROUP BY,
My Answer.
SELECT C.CONTINENT, FLOOR(AVG(CI.POPULATION))
FROM CITY CI
JOIN COUNTRY C
ON CI.COUNTRYCODE = C.CODE
GROUP BY C.CONTINENT
References.
'HackerRank > SQL' 카테고리의 다른 글
| [HackerRank/SQL] Basic SELECT - Employee Salaries (0) | 2022.07.01 |
|---|---|
| [HackerRank/SQL] Basic Join - The Report (0) | 2022.06.27 |
| [HackerRank/SQL] Basic Join - Population Census (0) | 2022.05.26 |
| [HackerRank/SQL] Advanced Select - The PADS (0) | 2022.05.14 |
| [HackerRank/SQL] Advanced Select - Type of Triangle (0) | 2022.05.12 |
Comments