개인공부/SQL
[SQL]해커랭크 African Cities 문제 풀이
k솔이
2023. 4. 22. 17:22
내용>
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.
즉, COUNTRY.CONTINENT = 'Africa' 인 CITY.NAME 을 조회해라.
CITY.CountryCode and COUNTRY.Code 는 매칭된다.
조인 기초문제라서 금방 풀 수 있었다.
뜬끔, TMI이지만 방금 코드블럭 기능을 찾았다..
훨씬 보기가 좋다.^___^
SELECT B.NAME
FROM COUNTRY A
INNER JOIN CITY B ON A.Code = B.CountryCode
WHERE A.CONTINENT = 'Africa'
끝.