728x90
반응형
https://www.hackerrank.com/challenges/weather-observation-station-20/problem?isFullScreen=true
Weather Observation Station 20 | HackerRank
Query the median of Northern Latitudes in STATION and round to 4 decimal places.
www.hackerrank.com
문제
A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to decimal places.
Input Format
The STATION table is described as follows:
![](https://blog.kakaocdn.net/dn/s5oea/btsswVjiuk8/kS2G7xaAcFPfGMXaujVt31/img.jpg)
where LAT_N is the northern latitude and LONG_W is the western longitude.
Code
SELECT ROUND(LAT_N, 4)
FROM (SELECT LAT_N, PERCENT_RANK() OVER (ORDER BY LAT_N) AS R FROM STATION) AS S
WHERE S.R=0.5
728x90
반응형
'SQL > MySQL' 카테고리의 다른 글
[MySQL/HackerRank] Ollivander's Inventory (0) | 2023.08.29 |
---|---|
[MySQL/HackerRank] Top Competitors (0) | 2023.08.29 |
[MySQL/HackerRank] New Companies (0) | 2023.08.29 |
[MySQL/HackerRank] Binary Tree Nodes (0) | 2023.08.29 |
[MySQL/HackerRank] Occupations (0) | 2023.08.29 |