We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Weather Observation Station 19
Weather Observation Station 19
Sort by
recency
|
2367 Discussions
|
Please Login in order to post a comment
MYSQL Solution
`
SQL Server Solution
After a lot of searching, I finally found the answer, because I had no idea that the Euclidean distance was the standard way to measure distance. Later, I got it and understood everything.
SET @min_lat_n = (SELECT MIN(lat_n) FROM station); set @min_long_w = (select min(long_w) from station); set @Max_lat_n = (select max(lat_n) from station); set @max_long_w = (select max(long_w) from station);
select round(sqrt(pow(@Max_lat_n - @min_lat_n, 2) + pow(@max_long_w - @min_long_w, 2)), 4) from station limit 1;
select round(sqrt(power(max(LAT_N)-min(LAT_N),2)+pow(max(LONG_W)-min(LONG_W),2)),4) from station; /* d≈ (Δx)^ 2+(Δy)^ 2
SELECT ROUND(SQRT(POWER(MAX(LAT_N)-MIN(LAT_N),2)+ POWER(MAX(LONG_W)-MIN(LONG_W),2)),4) FROM STATION