HackerRank SQL
Published in
Mar 25, 2021
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:
Solution (MySQL):
select city.name
from city
join
( select * from country where continent = 'Africa'
) t
on city.countrycode = t.code
;