So let's talk about solutions to these.
The first one to delete all four year old cats.
All we need to do is start off and you don't have to do this.
But I like to start off by making sure we're selecting things correctly.
So select start from cats where age equals four, we get Ringo.
Then I just like to copy this.
And do a delete from cats.
And of course I forgot to add a space but delete from cats for ages four.
Now if we do a let's do our first select, we should see nothing.
And if we do a select star.
We should see that we're now missing number one.
Who was Ringo by Ringo.
Next up, delete cats whose age is the same as their cat ID.
So this one involved something slightly different, like I mentioned, where we're not just checking
for a specific piece of data like breed equals Maine -- or age equals 12.
But we're checking where cat ID equals age.
So we'll do a select first select star from cats where cat ID equals H.
Or you could do age equals cat ID and we get jack cat ID is seven age seven.
Great.
So then we'll just copy this.
And do our delete from cats where cat id equals age.
It says one row affected.
If we try and select it again, it's gone.
And if we do a select star now, we're also missing Jack.
You can see we just have two, three, five and six, which leads us to our final example.
Delete all cats.
So this one is pretty straightforward.
If we try to do the equivalent select, it would just be select star from cats with no ensuing where
clause.
Just like that.
So to delete all of those, well, it's just delete from cats.
All of our cats are being released at once into a land of rainbows and joy.
We hit enter here.
They're definitely 100% not dying.
Nothing bad will ever happen to them.
Here we go.
Ford Rose affected select star from Cats The moment of truth.
And they're all gone and not dead.
Okay, so we've now covered the C and the R and the U and the D and crud that spells crud, which means
that we're done with this.
Next up, we'll get some practice putting it all together.