Why SUM(null) is not 0 in Oracle?

前端 未结 6 1937
轻奢々
轻奢々 2021-01-04 08:33

It would be appreciated explaining the internal functionality of SUM function in Oracle, when encountering null values:
The result of

select sum(null)          


        
6条回答
  •  伪装坚强ぢ
    2021-01-04 08:49

    Arithmetic aggregate functions ignore nulls.

    • SUM() ignores them
    • AVG() calculates the average as if the null rows didn't exist (nulls don't count in the total or the divisor)

提交回复
热议问题