SQL

[HackerRank] Aggregation > Weather Observation Station 15

halloweenie 2022. 12. 30. 17:22

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.

 

Input Format

The STATION table is described as follows:

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


[MySQL Solution 1]

select round(long_w, 4)
from station
where lat_n = (select max(lat_n) from station where lat_n < 137.2345);

 

[MySQL Solution 2]

select round(long_w,4) 
from station 
where lat_n < 137.2345 
order by lat_n desc limit 1;

 

 

문제 링크:

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