The Blunder

Jimin·2022년 8월 29일
0

HackerRank

목록 보기
19/27

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 calculating the amount of error (i.e.: average monthly salaries), and round it up to the next integer.

SELECT CEIL(AVG(SALARY)-AVG(TO_NUMBER(REPLACE(TO_CHAR(SALARY), '0'))))
FROM EMPLOYEES;
profile
https://github.com/Dingadung

0개의 댓글