Weather Observation Station 19
Consider P1(a,c) and P2(b,d) to be two points on a 2D plane where (a,b) are the respective minimum and maximum values of Northern Latitude (LAT_N) and (c,d) are the respective minimum and maximum values of Western Longitude (LONG_W) in STATION.
Query the Euclidean Distance between points P1 and P2 and format your answer to display 4 decimal digits.
(a,b)는 lat_n의 최소값과 최대값이며 (c,d)는 long_w의 최소값과 최대값이다. 유클리드 거리 P1, P2를 자릿수 4까지 표시하라는 문제다.
💡
truncate
하라는 말이 없으면 보통 ROUND()
함수를 사용하면 된다.-- 먼저 필요한 함수와 값을 적어둔다
-- SQRT(), POWER( ,2), ROUND( ,4)
-- a MIN(lat_n)
-- b MAX(lat_n)
-- c MIN(long_w)
-- d MAX(long_w)
SELECT ROUND(SQRT(POWER(MAX(lat_n)-MIN(lat_n), 2) + POW(MAX(long_w)-MIN(long_w), 2)), 4)
FROM station
💡💡