문제
Query the Western Longitude (LONG_W) for the largest Northern Latitude (LAT_N) in STATION that is less than 137.2345.
Round 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.
코드
SELECT round(long_w,4)
FROM Station
WHERE lat_n < 137.2345
ORDER BY lat_n DESC
LIMIT 1
풀이
- STATION 테이블의 LONG_W 조회
- 137.2345 이하인 가장 큰 LAT_N
LAT_N을 내림차순으로 정렬하고, 최대값을 출력하기 위해 LIMIT 1 - 소수점 이하 4번째 자리수까지 반올림
반응형
'Algorithm > MySQL' 카테고리의 다른 글
[프로그래머스] 이름이 있는 동물의 아이디 (MySQL) (0) | 2021.06.29 |
---|---|
[프로그래머스] 이름이 없는 동물의 아이디 (MySQL) (0) | 2021.06.29 |
[해커랭크(HackerRank)] Higher Than 75 Marks (MySQL) (0) | 2021.06.28 |
[해커랭크(HackerRank)] Employee Salaries (MySQL) (0) | 2021.06.28 |
[해커랭크(HackerRank)] Employee Names (MySQL) (0) | 2021.06.28 |