The Blunder

Sort by

recency

|

2105 Discussions

|

  • + 0 comments

    SELECT CEIL(AVG(SALARY) - AVG(REPLACE(SALARY, '0', ''))) FROM EMPLOYEES;

  • + 0 comments

    how to tackle the problem can any one briefly expline it!.

  • + 0 comments

    That's it

    SELECT CEIL(AVG(salary) - AVG(REPLACE(salary,0,""))) FROM Employees;

  • + 0 comments

    select cast(ceil(avg(cast(salary as decimal)) - avg(cast(replace(cast(salary as varchar(20)),'0','') as decimal))) as int) from employees; This will work for sure in DB2. Had to cry a lot over it. Till the end only because of rounding off trouble.

    Here, we typecast the integer salary to string in order to remove zeroes. Later we convert it into decimal for average substraction for clear rounding off. Finally we type cast into integer. Hope this helps.

  • + 0 comments

    SELECT CEILING( ABS( AVG(1.0 * Salary) - AVG(1.0 * CAST(REPLACE(Salary, '0', '') AS INT)) ) ) AS error_amount FROM Employees;