The Blunder

Sort by

recency

|

2139 Discussions

|

  • + 0 comments

    SELECT CAST( CEILING( AVG(CAST(salary AS FLOAT)) - AVG(CAST(REPLACE(CAST(salary AS VARCHAR(20)), '0', '') AS FLOAT)) ) AS INT ) FROM employees;

  • + 0 comments

    SELECT ceil(avg(Salary) - avg(replace(salary,'0',''))) from EMPLOYEES;

  • + 0 comments

    in sql server, I needed multiple casting

    select cast(ceiling((avg(cast(salary as float))) - avg(cast(replace(cast(salary as varchar),'0','') as float))) as integer)
    from 
    employees
    
  • + 0 comments

    SELECT Ceiling(AVG(salary-REPLACE(salary, '0', ''))) from EMPLOYEES;

    Calculate the differences first, and then apply the avg, and then ceilling

  • + 0 comments

    select ceil(avg(salary) - avg(replace(salary,'0',''))) from employees

    here if we use round it will round the number to nearest whole number, that's why we use ceil. so it will round the element to nearest integer.