SQL

HackerRank_SQL_Weather Observation Station 15, 소숫점

응엉잉 2023. 1. 5. 14:13

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

 

Weather Observation Station 15 | HackerRank

Query the Western Longitude for the largest Northern Latitude under 137.2345, rounded to 4 decimal places.

www.hackerrank.com

소숫점 처리

CEIL(숫자) -- 올림

FLOOR(숫자) -- 내림

ROUND(숫자, 자리수) -- 반올림

 

최대/최솟값 찾기 -> ORDER BY + LIMIT 조합

SELECT ROUND(long_w, 4)
FROM station
WHERE lat_n < 137.2345
ORDER BY lat_n DESC
LIMIT 1