We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT CAST(ROUND(SUM(LAT_N), 2) AS DECIMAL(10,2)), CAST(ROUND(SUM(LONG_W), 2) AS DECIMAL(10,2)) FROM STATION;
Successful submission on DB2 server => calculate the sum -> round() which rounds to 2 decimal places but includes trailing zeros as well -> cast it to Decimal(10,2) to remove any trailing zeros after 2 decimal places
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 2
You are viewing a single comment's thread. Return to all comments →
SELECT CAST(ROUND(SUM(LAT_N), 2) AS DECIMAL(10,2)), CAST(ROUND(SUM(LONG_W), 2) AS DECIMAL(10,2)) FROM STATION;
Successful submission on DB2 server => calculate the sum -> round() which rounds to 2 decimal places but includes trailing zeros as well -> cast it to Decimal(10,2) to remove any trailing zeros after 2 decimal places