> For the complete documentation index, see [llms.txt](https://dshub.gitbook.io/ds-hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dshub.gitbook.io/ds-hub/sql/sql-practice/popular-websites-for-sql-practice/hackerrank/sql-basic/weather-observation-station-18.md).

# Weather Observation Station 18

[Question Link](https://www.hackerrank.com/challenges/weather-observation-station-18/problem?isFullScreen=true)

Consider ***P1(a,b)*** and  ***P2*****(c,d)** to be two points on a *2D* plane.

* &#x20;***a*** happens to equal the minimum value in *Northern Latitude* (*LAT\_N* in **STATION**).
* &#x20;***b*** happens to equal the minimum value in *Western Longitude* (*LONG\_W* in **STATION**).
* &#x20;***c*** happens to equal the maximum value in *Northern Latitude* (*LAT\_N* in **STATION**).
* &#x20;***d*** happens to equal the maximum value in *Western Longitude* (*LONG\_W* in **STATION**).

Query the [Manhattan Distance](https://en.wikipedia.org/wiki/Taxicab_geometry) between points ***P1*** and ***P2*** and round it to a scale of 4 decimal places.<br>

The **STATION** table is described as follows: \
![](https://s3.amazonaws.com/hr-challenge-images/9336/1449345840-5f0a551030-Station.jpg)

where **LAT\_N** is the northern latitude and **LONG\_W** is the western longitude.

```sql
SELECT ROUND(ABS(MAX(lat_n)-MIN(lat_n)) + ABS(MAX(long_w)-MIN(long_w)),4)
FROM Station

```
