title: Euclidean Distance
body: <p><a href="https://www.hackerrank.com/challenges/weather-observation-station-19" rel="nofollow">Hacker Rank - Weather Observation Station 19</a></p>
  
  <blockquote>
    <p>Given a table STATION that holds data for five fields namely ID, CITY,
    STATE, NORTHERN LATITUDE and WESTERN LONGITUDE.</p>
  
  <pre><code>+-------------+------------+
  | Field       |   Type     |
  +-------------+------------+
  | ID          | INTEGER    |
  | CITY        | VARCHAR(21)|
  | STATE       | VARCHAR(2) |
  | LAT_N       | NUMERIC    |
  | LONG_W      | NUMERIC    |
  +-------------+------------+
  </code></pre>
    
    <p>Consider P1(a, b) and P2(c, d) be two points on 2D plane, where (a,
    b) be minimum and maximum values of Northern Latitude and (c, d) be
    minimum and maximum values of Western Longitude. Write a query to
    print the Euclidean Distance between points P1 and P2 up to 4 decimal
    digits.</p>
  </blockquote>
  
  <p>my solution for oracle is :</p>
  
  <pre><code>select round((abs(max(lat_n)-max(long_w)) + abs(min(long_w)-min(lat_n))),4) from station;  
  </code></pre>
  
  <p>but it is giving answer to the 3 decimal points but i need 4 decimal points.</p>