WEBVTT

00:00.060 --> 00:02.550
So we've covered creating and reading.

00:02.730 --> 00:05.400
Now we're on to updating our shirts.

00:05.490 --> 00:11.870
So the first problem is to update all polo shirts and change their size to be large.

00:11.970 --> 00:21.630
So we'll start by just selecting polo shirts select star from shirts where article equals polo shirt

00:21.840 --> 00:23.850
just like that.

00:23.900 --> 00:29.490
OK so this is what we get and what we want to do is change shirt size to be large.

00:29.680 --> 00:38.170
So we need to keep this copy it now and then will type out update shirts set.

00:38.290 --> 00:43.560
And we want to change shirts size to now be large.

00:44.140 --> 00:48.340
And where do we want to do that only wear article is polo shirt.

00:48.580 --> 00:49.610
Hit enter.

00:49.990 --> 00:51.830
We get three roads affected.

00:52.000 --> 00:53.590
Three rows changed.

00:53.770 --> 01:01.990
Now if we go back and run our same select We should see all polo shirts are now large as we could do

01:01.990 --> 01:06.030
the same thing just to see it in the grand scheme of things.

01:08.140 --> 01:08.710
There we go.

01:08.740 --> 01:09.910
We have three largest now.

01:09.950 --> 01:18.140
All polo shirt the next problem is to update the shirt last worn 15 days ago and change the last one

01:18.230 --> 01:19.650
to be zero.

01:20.240 --> 01:32.120
So we'll start by just selecting that shirt like we did earlier where last worn equals 15.

01:32.150 --> 01:32.690
There it is.

01:32.690 --> 01:38.190
Tank top blue medium last one 15 days ago and we wore it today.

01:38.420 --> 01:39.150
It was a hot day.

01:39.170 --> 01:43.450
Needed a tank top and we want to update it last one to be zero.

01:44.210 --> 01:56.680
So update Schertz set last warn equal to zero where last one is currently 15.

01:56.740 --> 02:00.140
We get one row affected one changed.

02:00.280 --> 02:02.060
Let's do our select again.

02:02.530 --> 02:03.810
We no longer have it.

02:03.940 --> 02:09.670
But now if we say select where lost where and zero we have two shirts this T-shirt that was already

02:09.670 --> 02:12.220
there in our blue tank top we just added.

02:12.540 --> 02:13.960
Perfect.

02:14.030 --> 02:21.320
So the final update is to update all white shirts change their size to extra small and at the same time

02:21.470 --> 02:22.900
change their color to off white.

02:23.060 --> 02:24.370
So this needs to happen all at once.

02:24.370 --> 02:25.820
You can't do two lines.

02:25.820 --> 02:29.200
I mean you could but that's against the rules for this problem.

02:29.270 --> 02:41.910
So let's start off by just selecting all white shirts like star from shirts where color equals white.

02:42.310 --> 02:44.440
No way.

02:45.040 --> 02:47.050
Get rid of that extra L there.

02:47.050 --> 02:47.710
Here we go.

02:47.890 --> 02:50.140
So we have two shirts a T-shirt that's.

02:50.160 --> 02:51.970
It's small and a tank top.

02:51.970 --> 02:52.630
That's white.

02:52.660 --> 02:53.720
That's small.

02:54.040 --> 02:59.500
So we want to change color to be off white and shirt size to be extra small because we shrink them and

02:59.500 --> 03:02.810
we mix them with colored stuff in the washing machine.

03:02.890 --> 03:05.790
So their colors now off white.

03:05.860 --> 03:18.330
So to do that let's start with the first part update shirts and we'll set color to be off white and

03:18.330 --> 03:29.010
then we'll do the second part with a comma shirt size equals x x x or small just like that and then

03:29.010 --> 03:37.160
we'll do our where color currently equals white and that should do it.

03:37.170 --> 03:38.610
Fingers crossed.

03:38.610 --> 03:40.220
No typos.

03:40.260 --> 03:45.010
Now if we go back and select where color is white we should have nothing.

03:45.750 --> 03:51.780
But if we say we're color is off white we should have two that are extra smalls or we could of course

03:51.780 --> 03:55.020
do select star from shirts to check our work.

03:55.140 --> 03:58.610
We have extra small off white X or small off white.

03:58.880 --> 03:59.150
OK.

03:59.160 --> 04:05.010
So that problem is just making sure that you could update multiple fields at once making sure you understood

04:05.010 --> 04:05.720
that.

04:06.140 --> 04:07.790
OK that's it for update.

04:07.830 --> 04:10.020
Next we move onto the delete.
