📅  最后修改于: 2022-03-11 15:05:11.534000             🧑  作者: Mango
# 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';