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(38,2)) as [lat],
cast(Round(sum(long_W),2) as decimal(38,2)) as [lon]
from station
/*
Only the round doasn't get rid of the trailing zeros. So you have to cast as decimal then (38, 2).
The 38 is for precision, this means you can have a total of 38 digits in total (left and right of the decimal point).
The 2 is for scale, this means the number of digits that are gonna be stored agter the decimal point.
*/
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(38,2)) as [lat], cast(Round(sum(long_W),2) as decimal(38,2)) as [lon] from station
/* Only the round doasn't get rid of the trailing zeros. So you have to cast as decimal then (38, 2). The 38 is for precision, this means you can have a total of 38 digits in total (left and right of the decimal point). The 2 is for scale, this means the number of digits that are gonna be stored agter the decimal point.
*/