CODING TEST/SQL : HackerRank

[MYSQL] Weather Observation Station 13

주 녕 2021. 8. 16. 18:13
반응형

 SQL  >  Aggregation > Weather Observation Station 13

 

 Problem 

Query the sum of Northern Latitudes (LAT_N) from STATION having values greater than 38.7880 and less than 137.2345. Truncate your answer to 4 decimal places.

→ 38.7880보다 크고 137.2345보다 작은 LAT_N의 합을 구하고 4번째 자리에서 내림(turncate)해라

 

Input Format

The STATION table is described as follows:

 My Answer 

SELECT TRUNCATE(SUM(LAT_N), 4)
FROM STATION
WHERE LAT_N > 38.7880 AND LAT_N < 137.2345

 

 NOTE 

내림 함수는 TURNCATE(숫자, 자릿수) 숫자 함수를 사용하자!

MYSQL의 숫자 함수아래 포스팅을 참고!

 

[MYSQL] The Blunder

SQL > Aggregation > The Blunder  Problem Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's 0 key was b..

junyoung-developer.tistory.com

 

반응형