Milky's note

[HackerRank](E) Weather Observation Station 13 본문

SQL/SQL 코딩 테스트-HackerRank

[HackerRank](E) Weather Observation Station 13

밀뿌 2022. 3. 25. 17:34

https://www.hackerrank.com/challenges/weather-observation-station-13/problem?isFullScreen=true 

 

Weather Observation Station 13 | HackerRank

Query the sum of Northern Latitudes having values greater than 38.7880 and less than 137.2345, truncated to 4 decimal places.

www.hackerrank.com

 

[문제]

Query the sum of Northern Latitudes (LAT_N) from STATION having values greater than 38.7880 and less than 137.2345 . Truncate your answer to  4 decimal places.

Input Format

The STATION table is described as follows:

where LAT_N is the northern latitude and LONG_W is the western longitude.

 

 

[답]

-mysql

select truncate(sum(lat_n),4) from station
where lat_n > 38.7880
and lat_n < 137.2345

해당 조건에 맞는 값들의 합을 출력하는데 반올림이 아니고 4자리까지 버림을 사용해야하므로 truncate를 사용해주었다.

Comments