본문 바로가기

mysql round3

[MYSQL] Weather Observation Station 2 ▶ SQL > Aggregation > Weather Observation Station 2 Problem Query the following two values from the STATION table: The sum of all values in LAT_N rounded to a scale of 2 decimal places. → LAT_N의 모든 값의 합을 소수점 2자리까지 반올림한 값 The sum of all values in LONG_W rounded to a scale of 2 decimal places. → LONG_W의 모든 값의 합을 소수점 2잘까지 반올림한 값 Input Format The STATION table is described as follows: where LAT_N is.. 2021. 8. 9.
[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 broken until after completing the calculation. She wants your help finding the difference between her miscalculation (using salaries with any zeros removed), and the actual average salary. Write a query .. 2021. 5. 18.
[MySQL] Average Population ▶ SQL > Aggregation > Average Population Problem Query the average population for all cities in CITY, rounded down to the nearest integer. Input Format The CITY table is described as follows: My Answer SELECT ROUND(AVG(POPULATION)) FROM CITY NOTE ROUND 함수 : 반올림 ROUND(컬럼명) - 소수점 1번째 자리에서 반올림 (123.7 → 124) ROUND(컬럼명, 1) - 출력할 소수점 자리 지정 (123.75 → 123.8) ROUND(컬럼명, -1) - 10단위로 반올림 (123 → 120) TRUNCA.. 2021. 4. 21.
728x90