HackerRank/SQL

[hackerrank] Population Census

예쁜꽃이피었으면 2022. 9. 6. 16:58

[hackerrank] Prepare > SQL > Aggregation > Population Census

 

[문제]

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: 

 

[MYSQL]

 

 

[ORCALE]

 

    select sum( a.population)
    from city a inner join country b on (a.countrycode = b.code)
    where continent = 'Asia';

 

 

반응형