본문 바로가기

Language/SQL

[HackerRank][SQL][JOIN] African Cities- 컴도리돌이

728x90
 

African Cities | HackerRank

Query the names of all cities on the continent 'Africa'.

www.hackerrank.com


Problem

Given the CITY and COUNTRY tables, query the names of all cities where the CONTINENT is 'Africa'.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

 

-> 아프리카 대륙에 있는 모든 도시의 이름을 출력하시오.


Answer

select a.name
from city a inner join country b on a.countrycode = b.code
where b.continent = "Africa"