SQL Sum Show 0 Hasil

# if WHERE... finds no rows, then sum(grade) == null, so returns an empty table
# Using COALESCE, if null, then values = 0, returns 1 row with value == 0
SELECT COALESCE(SUM(grade), 0) as sum FROM grades
WHERE project_title = 'Recipe Storage';
Muddy Macaque