Day 17.
A NULL value is usually a placeholder for an unknown value.
First, consider SQL commands and how they react to nulls. This will prevent incorrect queries, and is dependent on the needed output e.g. COUNT(*) will take nulls into consideration, while COUNT(column_name) will focus on only rows that have a known value in that column.
Using UPDATE, SET, and WHERE commands, NULL values in a column or table can be identified and replaced by a more meaningful value.
The IS NULL or IS NOT NULL functions can be used to return rows that contain or do not contain NULL values in a column, respectively.
When calculating the average value of a column, NULL values are usually not considered and this is because, as expected, they are unknown.
Case statements are another great way of handling NULL values, usually with expected conditions attached in the query.
Finally, using the COALESCE function is another way to handle NULL values.
This function accepts a number of expressions and return the first non-null expression.
Handling NULL Values is a very important aspect of data cleaning with SQL.
If improperly addressed, there is usually the risk of generating faulty information and insights from our database.
#20dayswithdata #NULLValues #DataCleaning