Japan Population

 

select sum(population)
from city
where Countrycode = 'JPN'

 

The Blunder

select ceil(avg(salary) - (select avg(replace(salary, 0, '')) from employees))
from employees

 

Weather Observation Station 2

select round(sum(lat_n), 2), round(sum(long_w), 2)
from station

 

Weather Observation Station 13

select round(sum(lat_n), 4)
from station
where 38.7880 < lat_n and lat_n < 137.2345

 

Weather Observation Station 14

select round(max(lat_n), 4)
from station
where lat_n < 137.2345

 

Weather Observation Station 16

select round(min(lat_n), 4)
from station
where 38.778 < lat_n

 

Weather Observation Station 17

select round(long_w, 4)
from station
where lat_n = (select min(lat_n)
              from station
              where lat_n > 38.7780)

 

Weather Obseravation Station 18

select round((c-a) + (d-b), 4)
from
(select min(lat_n) as a,
       min(long_w) as b,
       max(lat_n) as c,
       max(long_w) as d
from station) t1

 

Weather Observation Station 19

select round(sqrt(power((b-a),2) + power((d-c),2)),4)
from
(select min(lat_n) as a,
       max(lat_n) as b,
       min(long_w) as c,
       max(long_w) as d
from station) as t1

 

(문제 출처 - https://www.hackerrank.com/domains/sql)

 

+ Recent posts