코딩 연습/SQL

[Hacker Rank] Revising Aggregations1

썬2 2021. 4. 4. 23:33
# 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;