관리 메뉴

오늘도 배운다

The Blunder / HackerRank, SQL, MySQL 본문

코딩테스트연습(SQL)

The Blunder / HackerRank, SQL, MySQL

LearnerToRunner 2022. 12. 14. 07:26

문제

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.:  actual - miscalculated average monthly salaries), and round it up to the next integer.

 

Input Format

 

제출답안(MySQL)

SELECT CEIL(AVG(salary) - AVG(REPLACE(salary, 0, '')))
FROM employees

 

 

문제 바로가기(MySQL) 

 

728x90
Comments