# Population Census in SQL | HackerRank Solution

Hello coders, today we are going to solve Population Census HackerRank Solution in SQL.

## Problem

Given the CITY and COUNTRY tables, query the sum of the populations of all cities where the CONTINENT is ‘Asia’.

Note: CITY.CountryCode and COUNTRY.Code are matching key columns.

## Input Format

The CITY and COUNTRY tables are described as follows:

## Solution – Population Census in SQL

### MySQL

```select sum(city.population) from country
left join city on country.code = city.countrycode
where country.continent = 'Asia'```

Disclaimer: The above Problem (Population Census) is generated by Hacker Rank but the Solution is Provided by CodingBroz. This tutorial is only for Educational and Learning Purpose.

### 2 thoughts on “Population Census in SQL | HackerRank Solution”

1. SELECT sum(city.population)
FROM city
INNER JOIN country
ON city.countrycode = country.code where continent=’asia’;

2. select sum(city.population) from city join country on city.countrycode=country.code
where country.continent=’Asia’;
This will also work why you confuse other.