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((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.
The Blunder
You are viewing a single comment's thread. Return to all comments →
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.