Algorithm


Problem Name: Sql - Weather Observation Station 20

Problem Link: https://www.hackerrank.com/challenges/weather-observation-station-20/problem?isFullScreen=true 

In this HackerRank Functions in SQL problem solution,

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.

 

 

Code Examples

#1 Code Example with MySQL

Code - MySQL


Select round(S.LAT_N,4) from station AS 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);
Copy The Code & Try With Live Editor
Advertisements

Demonstration


Previous
[Solved] Weather Observation Station 19 in SQL solution in Hackerrank
Next
[Solved] The Report in SQL solution in Hackerrank