[hackerrank] Prepare > SQL > Aggregation > Weather Observation Station 19
[문제]
Consider and to be two points on a 2D plane where are the respective minimum and maximum values of Northern Latitude (LAT_N) and are the respective minimum and maximum values of Western Longitude (LONG_W) in STATION.
Query the Euclidean Distance between points and and format your answer to display decimal digits.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
[MYSQL]
[ORCALE]
모르겠어서 그냥 검색했다.
select
round(sqrt(power(max(LAT_N) - min(LAT_N),2) +
power(max(LONG_W) - min(LONG_W),2)),4)
from station
https://en.wikipedia.org/wiki/Euclidean_distance
제곱 구하기 POWER(n1 , n2)
- 첫번째 인자값이 음수인 경우 실수를 제공할 수 없다.
제곤급 구하기 sqrt(대상 숫자)
- 양의 자리 실수만 가능
반응형
'HackerRank > SQL' 카테고리의 다른 글
[hackerrank] African Cities (0) | 2022.09.06 |
---|---|
[hackerrank] Population Census (0) | 2022.09.06 |
[hackerrank] Weather Observation Station 18 (0) | 2022.09.06 |
[hackerrank] Weather Observation Station 17 (0) | 2022.09.06 |
[hackerrank] Weather Observation Station 16 (0) | 2022.09.06 |