-
Weather Observation Station 18<HackerRank> 2023. 7. 17. 21:25728x90
Weather Observation Station 18
-- MYSQL
WITH POINTS as (
SELECT
MIN(LAT_N) AS a,
MIN(LONG_W) AS b,
MAX(LAT_N) AS c,
MAX(LONG_W) AS d
FROM STATION
)
SELECT ROUND(ABS((a-c)+(b-d)),4)
FROM POINTS
-- MS SQL SERVER
SELECT CAST(ABS((max(LAT_N) - min(LAT_N)) + (max(LONG_W) - min(LONG_W))) AS decimal(10,4))
FROM station
-- ORACLE
select round(max(LAT_N)-min(LAT_N)+max(LONG_W)-min(LONG_W),4) from STATION;
-- DB2
SELECT
CAST(
ROUND(
ABS(MIN(LAT_N) - MAX(LAT_N)) +
ABS(MIN(LONG_W) - MAX(LONG_W)),
4
) AS DECIMAL(20,4)
)
FROM STATION;728x90'<HackerRank>' 카테고리의 다른 글
Weather Observation Station 19 (0) 2023.07.19 NEW Companies (0) 2023.07.14 Binary Tree Nodes (0) 2023.07.12 The PADS (0) 2023.07.10