Weather Observation Station 20 sql – Hacker Rank Solution

Weather Observation Station 20 sql - Hacker Rank Solution
Weather Observation Station 20 – Hacker Rank Solution

Problem

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:

1449345840 5f0a551030 Station

where LAT_N is the northern latitude and LONG_W is the western longitude.



Weather Observation Station 20 sql – Hacker Rank Solution

SET @rowIndex := -1;
SELECT ROUND(AVG(t.LAT_N), 4) FROM
(
SELECT @rowIndex := @rowIndex+1 AS rowIndex, s.LAT_N FROM STATION AS s ORDER BY s.LAT_N
) AS t
WHERE t.rowIndex IN (FLOOR(@rowIndex / 2), CEIL(@rowIndex / 2));

Disclaimer: The above Problem (Weather Observation Station 20 ) generated by Hackerrank but the Solution is Provided by Chase2Learn. This tutorial is only for Educational and Learning purposes. Authority if any of the queries regarding this post or website fill the following contact form thank you.

Leave a Comment