The Blunder

  • + 1 comment

    SQL SERVER-

    select ceiling((avg(cast(salary as decimal))- avg(cast(replace(salary,0,'')as decimal)))) from EMPLOYEES

    Explaination- as we need to cast salary column into DECIMAL because avg function is giving rounded value (salary column is of INT datatype), so to get exact average value.