Algorithm


Problem Name: Sql - Weather Observation Station 2

Problem Link: https://www.hackerrank.com/challenges/weather-observation-station-2/problem?isFullScreen=true

In this HackerRank Functions in SQL problem solution,

Query the following two values from the STATION table:

  1. The sum of all values in LAT_N rounded to a scale of 2 decimal places.
  2. The sum of all values in LONG_W rounded to a scale of2 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 lat is the sum of all values in LAT_N and lon is the sum of all values in LONG_W. Both results must be rounded to a scale of 2 decimal places.

 

 

Code Examples

#1 Code Example with MySQL

Code - MySQL


SELECT 
    ROUND(SUM(LAT_N), 2),
    ROUND(SUM(LONG_W), 2)
FROM
    STATION;
Copy The Code & Try With Live Editor
Advertisements

Demonstration


Previous
[Solved] Top Earners in SQL solution in Hackerrank
Next
[Solved] Weather Observation Station 13 in SQL solution in Hackerrank