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.
Oracle
SELECT ROUND(MEDIAN(LAT_N),4) FROM STATION;
MySQL
SELECT ROUND(LAT_N,4)
FROM STATION AS S
WHERE (SELECT COUNT(*) FROM STATION WHERE LAT_N<S.LAT_N) =(SELECT COUNT(*) FROM STATION WHERE LAT_N>S.LAT_N);
'Algorithm > SQL' 카테고리의 다른 글
[SQL][HackerRank] Placements (0) | 2020.06.11 |
---|---|
[SQL][HackerRank] Contest Leaderboard (0) | 2020.06.11 |
[SQL][HackerRank] Weather Observation Station 19 (0) | 2020.06.10 |
[SQL][HackerRank] Weather Observation Station 18 (0) | 2020.06.10 |
[SQL][HackerRank] Weather Observation Station 17 (0) | 2020.06.10 |