Recent Posts
Recent Comments
Link
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Archives
Today
Total
관리 메뉴

Studying data

[HackerRank] Aggregation > Weather Observation Station 15 본문

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 

Comments