Problem Name: Sql -
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.
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
#1 Code Example with MySQL
Copy The Code & Try With Live Editor
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);