Weather Observation Station 13

hyeh·2022년 8월 17일
0

알고리즘 문제풀이

목록 보기
8/15

Weather Observation Station 13

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.


SELECT TRUNCATE(SUM(lat_n), 4)
FROM station
WHERE lat_n > 38.7880 AND lat_n < 137.2345

-- 나의 오답!
SELECT ROUND(SUM(lat_n), 4)
FROM station
WHERE lat_n > 38.7880 AND lat_n < 137.2345

💡

  • ROUND() 함수를 사용해도 통과는 됐는데, 아마 반올림하는 마지막 자리의 값이 5이상이었으면 통과되지 않았을 것이다. 문제에 Truncate 하라고 명시되어 있기 때문에 truncate()를 사용해야 하는 문제다
  • TRUNCATE(숫자, 버릴 자릿수) : 숫자를 버릴 자릿수 아래로 버림
profile
좌충우돌 천방지축 룰루랄라 데이터 공부

0개의 댓글