Back Filling and Forward Filling

Learn how to fill missing data using SQL.

Overview

Missing data can result from legitimate causes or bugs, but either way, we have to deal with it. To make the analysis easier and to reduce the risk of potential errors caused by mishandling missing values, we sometimes want to fill missing data with other values.

Filling constant values

The most straightforward way to fill in missing data is to replace it with a constant value. To replace NULL values with a constant, we can use CASE:

Get hands-on with 1400+ tech skills courses.