We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT CEILING(ABS(
(SELECT AVG(SALARY) FROM EMPLOYEES) -
(SELECT AVG(CAST(REPLACE(CAST(SALARY AS CHAR), '0', '') AS SIGNED)) FROM EMPLOYEES)
)) AS error;
Cast is used to convert into integer again and ceiling is used to round up to next integer. abs is used to calculate absolute difference
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Blunder
You are viewing a single comment's thread. Return to all comments →
SELECT CEILING(ABS( (SELECT AVG(SALARY) FROM EMPLOYEES) - (SELECT AVG(CAST(REPLACE(CAST(SALARY AS CHAR), '0', '') AS SIGNED)) FROM EMPLOYEES) )) AS error;
Cast is used to convert into integer again and ceiling is used to round up to next integer. abs is used to calculate absolute difference