Milky's note

[HackerRank](E) Revising Aggregations - Averages 본문

SQL/SQL 코딩 테스트-HackerRank

[HackerRank](E) Revising Aggregations - Averages

밀뿌 2022. 3. 25. 16:00

https://www.hackerrank.com/challenges/revising-aggregations-the-average-function/problem?isFullScreen=true 

 

Revising Aggregations - Averages | HackerRank

Query the average population of all cities in the District of California.

www.hackerrank.com

 

[문제]

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

Input Format

The CITY table is described as follows: 

 

 

[답]

-mysql

select round(avg(population),2) from city
where district = 'California'

사실 이 문제는 반올림은 안 해도 되는데 뒤에 2자리로 남기고 싶어서 round를 썼는데

이것도 정답으로 맞게 해주었당

Comments