Please deal with null carefully.
SUM up some values with
NULL in it, we get a value.
WITH base AS ( SELECT 1 AS num UNION ALL SELECT 2 AS num UNION ALL SELECT NULL AS num ) SELECT SUM(num) FROM base
However, if one would add some values up, we get a NULL when one of them is
SELECT NULL + 10 AS null_plus_num
gives us a
Published: by Lei Ma;
Authors: Lei Ma
Table of Contents