as far as i understood the AVG() function ignores NULL Values.
So AVG(4,4,4,4,4,NULL) --> 4
In my case i don´t want this to happen.
I need a solution like that: AVG(4,4,4,4,4,NULL) --> 3,33
without replacing the NULL values directly in the table itself. Is there any way to do this?
Use coalesce()
to return the real value of zero for null columns:
select avg(coalesce(some_column, 0))
from ...