# Weather Observation Station 20 SQL Hacker Rank Solution

Hello coders, In this post, you will learn how to solve the Weather Observation Station 20 SQL Hacker Rank Solution. This problem is a part of the SQL Hacker Rank series.

## Weather Observation Station 20 SQL 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:

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.

Sharing Is Caring