We have one last very simple comparison function or operator actually that I'm going to show you, and
it has to do with null values.
So right now I have some null values in my books table like, well, these rows here have no author.
How would I target those rows?
Let's say I want to delete them or I want to just select them like select star from books.
Let's say where the author last name is null.
Well, it does not work to do this equals null.
I don't get anything back.
So instead of that, I have to use a special operator called is null.
We also have is not null and this is set up to work specifically with null values.
So instead of saying where all the last name is, equal sign no I'll say is null.
And now we find all of the books that have no last name, where the last name is set to no great.
I also have is not null.
So same thing, but opposite.
Now I'm getting back all the books that do have another last name that is not.
No.
So I guess we could end by deleting all of the books that have no author, last name or no title.
And again, the way that I like to do that is by starting with a selection, select what I'm trying
to delete and then delete.
So select star from books.
Where are we going to do title is null or last name?
Let's do title.
So I have two books that have no title.
Let's delete them.
So instead of select star from books where title is null, I'm going to do delete.
From books where title is null and it says two rows affected.
If I try and select those rose again, they're gone.
So just a quick example of using is null and is not null.
We can't directly compare using the equal sign to null or not equals.
Really we need to use is null.
End is not null.