Im between cherry

Hackerrank | MySQL | Weather Observation Station 15 본문

데이터분석/practice_query

Hackerrank | MySQL | Weather Observation Station 15

meal 2020. 8. 29. 11:15

Weather Observation Station 15

Problem

 

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

Query the Western Longitude (LONG_W) for the largest Northern Latitude (LAT_N) in STATION that is less than . Round your answer to  decimal places.

 

SELECT ROUND(LONG_W,4)
FROM STATION
WHERE LAT_N<137.2345
ORDER BY LAT_N DESC
LIMIT 1
-- from 절에 sub 쿼리 쓸 때 as 안해주면 런타임 오류 발생
-- as 뒤에 쓰는 이름은 아무거나 써도 상관없음 
SELECT round(Long_w,4)
FROM (
    SELECT *
    FROM Station
    WHERE Lat_n < 137.2345
) as sub
ORDER BY Lat_n DESC
Limit 1
Comments