티스토리 뷰

728x90

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:

SELECT SUM(A.population)
FROM CITY A
    JOIN COUNTRY B
    ON A.CountryCode = B.Code 
WHERE B.CONTINENT = 'Asia';

 

African Cities

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:

 

SELECT A.NAME
FROM CITY A
    JOIN COUNTRY B
    ON A.CountryCode = B.Code 
WHERE B.CONTINENT = 'Africa';

 

Average Population of Each Continent

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.

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

Input Format

The CITY and COUNTRY tables are described as follows:

SELECT B.Continent, TRUNCATE(AVG(A.Population),0)
FROM CITY A
    JOIN COUNTRY B
    ON A.CountryCode = B.CODE
GROUP BY B.Continent

 

 

 

728x90
LIST
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함