Sitemap
MaheswaraReddy

MaheswaraReddy

Gen AI Developer

Hackerrank-African Cities

Jan 9, 2023

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

Get MaheswaraReddy’s stories in your inbox

Join Medium for free to get updates from this writer.

The CITY and COUNTRY tables are described as follows:

Solution

SELECT CI.NAME
FROM CITY AS CI
JOIN COUNTRY AS CO ON CI.COUNTRYCODE = CO.CODE
WHERE CO.CONTINENT = ‘Africa’

Press enter or click to view image in full size

Thank you for reading.

--

--