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 just like start from cats where age equals four.
We get Ringo and I just like to copy this
and do a delete from cats.
And of course I forgot to add a space but the tweet from cats for ages for 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.
OK.
Next up do eat 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 Breede equals Maine
Coon or age equals 12 but we're checking we're cat ID equals age.
So we'll do a select first Nexstar from cats where cat ID equals H.
Or you could do Agios cat ID and we get Jack Kaede idea seven ages 7.
Great.
So then we'll just copy this
and do our delete from cats where cat equals age says one row affected.
If we try unselected again it's gone.
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.
Eat all cats.
So this one is pretty straightforward.
If we tried to do the equivalent select it would just be select star from cat with no ensuing where
clause just like that.
So to delete all of those.
Well it's just the leads 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 percent not dying.
Nothing bad will ever happen to them.
Here we go.
For those affected selected star from cats the moment of truth.
And they're all gone and not it.
OK so we've now covered the C and R in the U and the D in crud that spells crud.
Which means we're done with this.
Next up we'll get some practice putting it all together.