728x90
반응형
https://www.hackerrank.com/challenges/the-blunder/problem?isFullScreen=true
문제
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.
Input Format
The EMPLOYEES table is described as follows:
Code
SELECT CEIL(AVG(SALARY) - AVG(REPLACE(CAST(SALARY AS CHAR), '0', '')))
FROM EMPLOYEES
728x90
반응형
'SQL > MySQL' 카테고리의 다른 글
[MySQL/HackerRank] Population Census (0) | 2023.08.21 |
---|---|
[MySQL/HackerRank] Average Population of Each Continent (0) | 2023.08.21 |
[MySQL/HackerRank] Population Density Difference (0) | 2023.08.21 |
[MySQL/HackerRank] Japan Population (0) | 2023.08.21 |
[MySQL/HackerRank] Average Population (0) | 2023.08.21 |