728x90
728x90
Problem
Consider P1(a,b) and P2(c,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.
-> 다음을 소수점 4자리까지 출력하시오. (truncate)
점 p1과 점 p2의 유클리드 호제법 거리를 구하시오.
*유클리드 호제법의 제곱 + 제곱 의 루트를 power 함수만 사용해서 표현을 하였다.
Answer
select truncate(power(power(max(lat_n) - min(lat_n),2) + power(max(long_w) - min(long_w),2),0.5),4)
from station
728x90
728x90
'Language > SQL' 카테고리의 다른 글
[HackerRank][SQL][JOIN] African Cities- 컴도리돌이 (0) | 2022.05.28 |
---|---|
[HackerRank][SQL][Aggregation] Weather Observation Station 21 - 컴도리돌이 (0) | 2022.05.27 |
[HackerRank][SQL][Aggregation] Weather Observation Station 18 - 컴도리돌이 (0) | 2022.05.25 |
[HackerRank][SQL][Aggregation] Weather Observation Station 17 - 컴도리돌이 (0) | 2022.05.24 |
[HackerRank][SQL] Weather Observation Station 16 - 컴도리돌이 (0) | 2022.05.23 |