SELECT city.name
FROM city
INNER JOIN country ON country.code = city.countrycode
WHERE country.continent = 'Africa';

inner join은 양쪽에 데이터가 존재해야 데이터 출력

(교집합 개념)

 

(문제 출처 - https://www.hackerrank.com/domains/sql)

'섭섭의 공부 > SQL' 카테고리의 다른 글

[HackerRank] Average Population of Each Continent  (0) 2021.12.02
[HackerRank] Asian Population  (0) 2021.12.02
[LeetCode] Reformat Department Table  (0) 2021.12.01
[HackerRank] Type of Triangle  (0) 2021.12.01
[HackerRank] Top Earners  (0) 2021.12.01

+ Recent posts