일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- 최강의 인생
- 역행자
- Algorithms
- JavaScript
- 개발자의 책장
- 개발자_조이킴
- MySQL
- array.slice()
- 재귀함수
- for문
- 코딩테스트
- select
- Programmers
- 정규표현식
- array
- 배열
- Hackerrank
- array.push()
- Developer_JoyKim
- SQL
- 코딩공부
- 프로그래머스
- 알고리즘
- 블록체인
- node.js
- 코플릿
- 코드스테이츠
- 자바스크립트
- join
- 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