Monday, 25 March 2019

Weather Observation Station 2 HackerRank SQL Solution in MYSQL

Problem:-

Query the following two values from the STATION table:
  1. The sum of all values in LAT_N rounded to a scale of  decimal places.
  2. The sum of all values in LONG_W rounded to a scale of  decimal places.
Input Format
The STATION table is described as follows:
Station.jpg
where LAT_N is the northern latitude and LONG_W is the western longitude.
Output Format
Your results must be in the form:
lat lon
where  is the sum of all values in LAT_N and  is the sum of all values in LONG_W. Both results must be rounded to a scale of  decimal places.


Solution:-

SELECT
 CAST(SUM(LAT_N) AS DECIMAL(7,2)),
 CAST(SUM(LONG_W) AS DECIMAL(7,2))

FROM STATION

No comments:

Post a Comment

Error While embed the video in Your website page

Error:- Refused to display '<URL>' in a frame because it set 'X-Frame-Options' to 'sameorigin Solution:- if ...