/plushcap/analysis/fivetran/one-plus-null

A Friendly Reminder: One Plus NULL Equals NULL

What's this blog post about?

The text discusses the importance of handling NULL values appropriately when performing arithmetic operations across SQL columns. It provides an example where sales records from different jurisdictions and product categories are used to calculate total costs, with some missing tax or hazmat fees data represented as NULL. To handle these NULL values, the COALESCE function is recommended, which defaults to a value of 0 when encountering a NULL. The text also reminds that one plus NULL equals NULL in addition, subtraction, multiplication, and division operations.

Company
Fivetran

Date published
June 6, 2019

Author(s)
Charles Wang

Word count
274

Language
English

Hacker News points
None found.


By Matt Makai. 2021-2024.