Linear Interpolation

Learn how to apply linear interpolation to missing data in SQL.

Overview

So far, we've seen how to fill in missing data using constant values or using a next or a last known value. These approaches are fairly simple, but they are a bit crude. There are other interpolation methods that fill in missing values in a more natural way.

Linear interpolation formula

Using linear interpolation filling missing values along a linear line between two known coordinates , we fill in missing values along a linear line between two known coordinates–-the last known value and the next known value.

Get hands-on with 1400+ tech skills courses.