융무의 기술블로그
article thumbnail
Published 2020. 6. 13. 16:46
[SQL][HackerRank]African Cities Algorithm/SQL

https://www.hackerrank.com/challenges/african-cities/problem?h_r=next-challenge&h_v=zen

 

African Cities | HackerRank

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

www.hackerrank.com

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.

Input Format

The CITY and COUNTRY tables are described as follows:

  • join two tables ==> FROM CITY AS i JOIN COUNTRY AS o ON i.COUNTRYCODE=o.CODE
  • query names of all cities ==> SELECT i.NAME
  • where the Continent is ‘Africa’ ==> WHERE o.CONTINENT=‘Africa’
SELECT I.NAME 
FROM CITY AS I 
JOIN COUNTRY AS O ON I.COUNTRYCODE = O.CODE
WHERE O.CONTINENT = 'Africa';

profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!