# The Count Function
select count(ID)
from city
where population > 100000;
# The Sum Function
select sum(population)
from city
where district = 'California';
# Averages
select avg(population)
from city
where district = 'California';
# Average Population
select round(avg(population), 0)
from city;
# Japan Population
select sum(population)
from city
where countrycode='JPN';
# Population Density Difference
select max(population)-min(population)
from city;
'코딩 연습 > SQL' 카테고리의 다른 글
[Hacker Rank] Weather Observation Station 18 (0) | 2021.04.05 |
---|---|
[Hacker Rank] Aggregation2 (0) | 2021.04.05 |
[Hacker Rank] Occupations (0) | 2021.04.04 |
[HackerRank] Type of Triangle (0) | 2021.04.04 |
[HackerRank] The PADS (0) | 2021.04.04 |