https://www.hackerrank.com/challenges/african-cities/problem?h_r=next-challenge&h_v=zen
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';
'Algorithm > SQL' 카테고리의 다른 글
[SQL][HackerRank] Draw The Triangle 1 (0) | 2020.06.14 |
---|---|
[SQL][HackerRank] Average Population of Each Continent (0) | 2020.06.13 |
[SQL][HackerRank] Asian Population (0) | 2020.06.13 |
[SQL][HackerRank] The Report (0) | 2020.06.12 |
[SQL][HackerRank] Weather Observation Station 16 (0) | 2020.06.12 |