NULL Values
NULL values represent missing unknown data.
By default, a table column can hold NULL values.
It is not possible to compare NULL and 0; they are not equivalent.
To select NULL Values:
SELECT LastName,FirstName,Address FROM Persons WHERE Address IS NULL
MySQL does have an ISNULL() function. However, it works a little bit different from Microsoft’s ISNULL() function.
In MySQL we can use the IFNULL() function, like this:
SELECT ProductName,UnitPrice*(UnitsInStock+IFNULL(UnitsOnOrder,0)) FROM Products
OR
SELECT ProductName,UnitPrice*(UnitsInStock+COALESCE(UnitsOnOrder,0)) FROM Products
To select only the records with no NULL values:
SELECT LastName,FirstName,Address FROM Persons WHERE Address IS NOT NULL