문제
Samantha was tasked with calculating the average monthly salaries for all employees in the EMPLOYEES table, but did not realize her keyboard's 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 calculating the amount of error (i.e.: average monthly salaries), and round it up to the next integer.
실행 코드

# salaries with any zeros removed -> REPLACE 함수 이용하기
REPLACE(a,b,c) : a글자에서 b를 c로 바꾸기
REPLACE(salary,0,"") : salary 컬럼에 있는 데이터 값에서 0을 공백("") 처리
# round it up to the next integer -> CEIL 함수로 올림
'SQL > HackerRank' 카테고리의 다른 글
| [SQL] HackerRank: Symmetric Pairs (0) | 2023.06.01 |
|---|---|
| [SQL] HackerRank: INNER JOIN 문제 (0) | 2023.05.31 |
| [SQL] HakerRank: The Report (0) | 2023.05.31 |
| [SQL] HackerRank : Weather Observation Station 3 (0) | 2023.05.19 |
| [SQL] HackeRank : Weather Observation Station 11 (0) | 2023.05.19 |