DATA CLEANING WITH SQL (pt4)

 We have seen how to change data types using CAST and check for duplicates and Null values. But what do we do when we find some fields with NULL values and what do clean it out?

One of the ways is by using COALESCE. Coalesce returns a NULL field with a NON-NULL value.
The format for using COALESCE is COALESCE(the_column_with_null,replacement)

In the video below, there are 20 rows with NULL values in the Property Address field and we would like to replace the NULL values with the Owner Address.



The Query we use is: COALESCE(PropertyAddress, OwnerAddress) AS address.

This returns a column with the Null values in the PropertyAddress replaced with the OwnerAddress


Comments

Popular posts from this blog

EXPLORATORY ANALYSIS OF COVID_19 CASES AND VACCINATION IN NIGERIA