Skip to content

Commit 7ebb4c5

Browse files
authored
Merge pull request #2 from pankaj892/pankaj892-patch-2
Added solution for sql basic join
2 parents cd284bd + 35acacb commit 7ebb4c5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

SQL/average-population.sql

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
-- Average Population of Each Continent
2+
-- Given the CITY and COUNTRY tables, query the names of all the continents (COUNTRY.Continent) and their respective average city populations (CITY.Population) rounded down to the nearest integer.
3+
4+
Note: CITY.CountryCode and COUNTRY.Code are matching key columns
5+
-- https://www.hackerrank.com/challenges/average-population-of-each-continent/problem
6+
7+
SELECT country.continent, FLOOR(AVG(city.population))
8+
FROM city
9+
INNER JOIN country ON city.countrycode = country.code
10+
GROUP BY country.continent;

0 commit comments

Comments
 (0)