WEBVTT

00:00.060 --> 00:03.160
So let's talk about solutions to these.

00:03.180 --> 00:05.870
The first one to delete all four year old cats.

00:06.120 --> 00:11.040
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

00:11.040 --> 00:17.620
we're selecting things correctly just like start from cats where age equals four.

00:17.790 --> 00:20.940
We get Ringo and I just like to copy this

00:23.760 --> 00:28.520
and do a delete from cats.

00:29.160 --> 00:36.720
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

00:36.720 --> 00:39.680
first select We should see nothing.

00:39.680 --> 00:41.340
And if we do a select star

00:44.090 --> 00:49.560
we should see that we're now missing number one who was Ringo by Ringo.

00:49.940 --> 00:50.940
OK.

00:51.020 --> 00:52.840
Next up do eat cats.

00:52.840 --> 00:56.570
Whose age is the same as their cat ID.

00:56.870 --> 00:59.420
So this one involved something slightly different.

00:59.420 --> 01:05.240
Like I mentioned where we're not just checking for a specific piece of data like Breede equals Maine

01:05.240 --> 01:10.050
Coon or age equals 12 but we're checking we're cat ID equals age.

01:10.310 --> 01:20.800
So we'll do a select first Nexstar from cats where cat ID equals H.

01:20.930 --> 01:26.180
Or you could do Agios cat ID and we get Jack Kaede idea seven ages 7.

01:26.210 --> 01:27.010
Great.

01:27.350 --> 01:29.120
So then we'll just copy this

01:32.670 --> 01:39.530
and do our delete from cats where cat equals age says one row affected.

01:39.540 --> 01:41.580
If we try unselected again it's gone.

01:41.870 --> 01:46.160
If we do a select star now we're also missing Jack.

01:46.260 --> 01:52.480
You can see we just have two three five and six which leads us to our final example.

01:52.530 --> 01:54.390
Eat all cats.

01:54.390 --> 01:57.360
So this one is pretty straightforward.

01:57.930 --> 02:03.780
If we tried to do the equivalent select it would just be select star from cat with no ensuing where

02:03.780 --> 02:07.050
clause just like that.

02:07.080 --> 02:08.680
So to delete all of those.

02:08.880 --> 02:12.940
Well it's just the leads from cats.

02:13.050 --> 02:17.570
All of our cats are being released at once into a land of rainbows and joy.

02:17.730 --> 02:21.320
We hit enter here they're definitely 100 percent not dying.

02:21.630 --> 02:23.600
Nothing bad will ever happen to them.

02:23.790 --> 02:24.420
Here we go.

02:25.820 --> 02:32.130
For those affected selected star from cats the moment of truth.

02:32.690 --> 02:35.070
And they're all gone and not it.

02:35.450 --> 02:40.580
OK so we've now covered the C and R in the U and the D in crud that spells crud.

02:40.730 --> 02:41.960
Which means we're done with this.

02:41.960 --> 02:44.710
Next up we'll get some practice putting it all together.
