DATA/SQL

해커랭크 Revising Aggregations - Averages 외 5문제

열쩡왔쩡 2025. 5. 16. 12:30

Revising Aggregations - Averages

 

넘 오랜만에 해서 3트 만에 썩세스 ㅠ ㅋㅋㅋㅋ
이유 : where 을 from 전에 썼었고 "" 를 필드명에도 사용했어서 틀렸다.

 

#The Sum Function -> 한번에 통과

 

 

 

#틀린문제 - The Count Function

 

정답

select count(id) 또는 count(*)

from city

where population > 100,000

 

# Average Population

소수점 둘째자리에서 반올림 하는 방법 까먹은듯...

정답:

round down = 버림

 

select floor(avg(population))

from city

 

빼기 방법이 저게 맞나?

카운트도 헷갈린다 .. 

 

정답 :

위 답에 sum을 빼면 됨.

 

 

728x90