SQL 문제풀이

[해커랭크 SQL] Aggregation - Weather Observation Station 2

냄비짱 2023. 8. 25. 17:06
728x90

❓ Question
https://www.hackerrank.com/challenges/weather-observation-station-2

 

Weather Observation Station 2 | HackerRank

Write a query to print the sum of LAT_N and the sum of LONG_W separated by space, rounded to 2 decimal places.

www.hackerrank.com

❗ Answer

SELECT ROUND(SUM(lat_n),2), ROUND(SUM(long_w),2)
    FROM station;

📌 Discussion

  • 모든 lat_n과 long_w를 각각 합친 후 ROUND로 반올림하여 소수점 둘째자리까지 표현한다.