[HackerRank MySQL] Weather Observation Station 20
2021. 2. 25. 13:37ㆍToday I Learned.../MySQL
Weather Observation Station 20
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 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.
Solution
select round(lat_n, 4)
from station s
where (select count(*) from station where lat_n>s.lat_n)
= (select count(*) from station where lat_n<s.lat_n)
Reference: HackerRank Practice > SQL > Aggregation > Weather Observation Station 20
'Today I Learned... > MySQL' 카테고리의 다른 글
[HackerRank MySQL] Occupations (0) | 2021.02.25 |
---|---|
[HackerRank MySQL Server] Challenges - 서브쿼리 WITH절 활용 (0) | 2021.02.24 |
[HackerRank MySQL] The PADS (0) | 2021.02.23 |
[HackerRank MySQL] Binary Tree Nodes (0) | 2021.02.22 |
[HackerRank MySQL] Placements (0) | 2021.02.22 |