Use null in WHERE
You can search for null values by using the null keyword in SOQL queries.
This example query returns the account IDs of all events with a non-null activity date.
If you run a query on a boolean field, null matches FALSE values. For example, if Test_c is a boolean field, then the following query returns all the account records where Test_c is false:
The clause WHERE Test_c = null is equivalent to WHERE Test_c = false. The clause WHERE Test_c != null is equivalent to WHERE Test_c = true.
The WHERE clause behaves in two different ways, depending on the version, when handling null values in a parent field for a relationship query. In a WHERE clause that checks for a value in a parent field, the record is returned even if the parent does not exist.
Case record Id values are returned.
See Also