[SQL] [백문이불여일타] 데이터 분석을 위한 중급 SQL-집계함수 문제 풀이

한예은·2025년 2월 23일
0

코딩 테스트

목록 보기
2/49
post-thumbnail

후기

집계함수까지는 식은 죽 먹기다.

Revising Aggregations - Averages

Revising Aggregations - Averages

풀이

select avg(population)
from city
where district = "california"

Revising Aggregations - The Sum Function

Query the total population of all cities in CITY where District is California.

풀이

select sum(population)
from city
where district = "california"

Revising Aggregations - The Count Function

Query a count of the number of cities in CITY having a Population larger than 100,000.

풀이

select count(name)
from city
where population > 100000

Average Population

Query the average population for all cities in CITY, rounded down to the nearest integer.

풀이

select floor(avg(population))
from city

Population Density Difference

Query the difference between the maximum and minimum populations in CITY.

풀이

select max(population) - min(population)
from city

Weather Observation Station 4

Find the difference between the total number of CITY entries in the table and the number of distinct CITY entries in the table.
The STATION table is described as follows:

풀이

select count(city) - count(distinct city)
from station
profile
긴 여정의 첫 걸음

0개의 댓글