-
Book Overview & Buying
-
Table Of Contents
The SQL Workshop
By :
Before we learn to handle NULL values, let's define a NULL value. NULL equals nothing in SQL, so a field that has no value is considered NULL. Usually, NULL fields are the result of having optional fields in your tables.
Checking NULL values can be done using the following two special keywords, as it cannot be done using the logical operators:
IS NULLIS NOT NULLNote
An important point to highlight is the fact that fields with a value of 0, or invisible characters such as spaces, are not considered NULL. NULL fields are fields that are left blank.
Ideally, we want all customers' first names to be in our system. For any customer whose first name is missing from our data, we want to contact the customer and ask them about the missing information. To do this, we require a report of all the customers with missing first names: