SQL IS NULL
How do we select only the records with NULL values in the "Address" column?
We will have to use the IS NULL operator:
SELECT LastName,FirstName,Address FROM Persons WHERE Address IS NULL |
The result-set will look like this:
LastName | FirstName | Address |
---|---|---|
Hansen | Ola | |
Pettersen | Kari |
Tip: Always use IS NULL to look for NULL values.
SQL IS NOT NULL
How do we select only the records with no NULL values in the "Address" column?
We will have to use the IS NOT NULL operator:
SELECT LastName,FirstName,Address FROM Persons WHERE Address IS NOT NULL |
The result-set will look like this:
LastName | FirstName | Address |
---|---|---|
Svendson | Tove | Borgvn 23 |
No comments:
Post a Comment