select sum(A.POPULATION)
from CITY A
full outer join COUNTRY B
on A.CountryCode = B.Code
where B.CONTINENT = 'Asia';
select sum(A.POPULATION)
from CITY A
inner join COUNTRY B
on A.CountryCode = B.Code
where B.CONTINENT = 'Asia';
COUNTRY์ CITY ํ ์ด๋ธ์์
WHERE: CONTINENT๊ฐ 'Asia'์ธ
SELECT: ๋ชจ๋ ๋์ ์ธ๊ตฌ ์์ ํฉ(SUM)
JOIN์ ํ ๋๋ WHERE๋ฌธ์ผ๋ก ์กฐ๊ฑด์ ์ฃผ๊ธฐ ๋๋ฌธ์, FULL OUTER JOIN์ด๋ INNER JOIN์ด๋ ์๊ด์๋ค.
[HackerRank] Average Population of Each Continent (SQL/JOIN) (0) | 2021.02.01 |
---|---|
[HackerRank] African Cities (SQL/JOIN) (0) | 2021.02.01 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ณดํธ์์์ ์ค์ฑํํ ๋๋ฌผ (SQL/JOIN) (0) | 2021.01.30 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ค๋ ๊ธฐ๊ฐ ๋ณดํธํ ๋๋ฌผ(1) (SQL/JOIN) (0) | 2021.01.30 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์์๋๋ฐ์ ์์์ต๋๋ค (SQL/JOIN) (0) | 2021.01.23 |