Sometimes you need to sum up a column using SUM() function. This function return 'NULL' if for a specific column/field no record is found but in order to manipulate our results within query we need 0 instead of NULL. Same will be the case with other group functions like AVG, etc.
To overcome this issue, MySQL provides a function COALESCE() to convert a NULL value into 0. You can use this function as COALESCE(SUM(field_name), 0) .. this will return you 0 if no value is found.