Weather Observation Station 19
Weather Observation Station 19
+ 0 comments Using CTE
With CTE as
(select
min(lat_n) as a, max(lat_n) as b, min(long_w) as c, max(long_w) as d from station) selectround(
sqrt( power(abs(b-a),2) + power(abs(d-c),2) ) ,4)
from CTE ;
+ 0 comments Please use the below mysql code :
SELECT ROUND(SQRT(POWER(ABS(MAX(LAT_N)-MIN(LAT_N)), 2) + POWER(ABS(MAX(LONG_W)-MIN(LONG_W)), 2)),4) FROM STATION;
+ 0 comments MS SQL
SELECT CAST(SQRT( POWER(MAX(LAT_N) - MIN(LAT_N), 2) + POWER(MAX(LONG_W) - MIN(LONG_W), 2) ) AS DECIMAL (18,4)) AS euclidean_distance FROM STATION;
+ 0 comments SELECT ROUND (SQRT(POWER(MAX(s1.lat_n) - MIN(s2.lat_n), 2) + POWER(MAX(s1.long_w) - MIN(s2.long_w), 2)), 4) FROM station AS s1 CROSS JOIN station AS s2 WHERE s1.lat_n != s2.lat_n AND s1.long_w != s2.long_w ORDER BY 1 DESC LIMIT 1;
+ 0 comments select cast( sqrt( power(coalesce(min(lat_n),0)-coalesce(max(lat_n),0),2) + power(coalesce(min(long_w),0)-coalesce(max(long_w),0),2) ) as decimal(18,4) ) as a from station;
Sort 1844 Discussions, By:
Please Login in order to post a comment