cs

https://www.hackerrank.com/challenges/weather-observation-station-20/problem?isFullScreen=true&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen 

 

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 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.

 

[My Answer]

SELECT ROUND(A.LAT_N, 4) 
FROM STATION A
WHERE (SELECT ROUND(COUNT(A.ID)/2) - 1 FROM STATION) = 
      (SELECT COUNT(B.ID) FROM STATION AS B WHERE B.LAT_N > A.LAT_N);

역시.. 안하다가 하려니까 오래걸린다..

+ Recent posts