Weather Observation Station 20

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 Implementation


SELECT ROUND(S.LAT_N, 4) FROM STATION S 
WHERE 
    (SELECT COUNT(LAT_N) FROM STATION WHERE LAT_N > S.LAT_N) 
    = (SELECT COUNT(LAT_N) FROM STATION WHERE LAT_N < S.LAT_N);
Copied!

Leave a Reply

Your email address will not be published. Required fields are marked *