1 00:00:00,090 --> 00:00:02,190 So we've covered creating and reading. 2 00:00:02,580 --> 00:00:05,300 Now we're on to updating our shirts. 3 00:00:05,310 --> 00:00:10,800 So the first problem is to update all polo shirts and change their size to be large. 4 00:00:11,820 --> 00:00:21,740 So we'll start by just selecting polo shirts, select star from shirts where article equals polo shirt 5 00:00:21,750 --> 00:00:22,740 just like that. 6 00:00:24,360 --> 00:00:29,160 So this is what we get and what we want to do is change shirt size to be large. 7 00:00:29,550 --> 00:00:31,170 So we need to keep this. 8 00:00:31,200 --> 00:00:42,360 I'll copy it now and then we'll type out update shirts set and we want to change shirt size to now be 9 00:00:42,360 --> 00:00:43,230 large. 10 00:00:44,010 --> 00:00:45,440 And where do we want to do that? 11 00:00:45,450 --> 00:00:48,060 Only where article is polo shirt. 12 00:00:48,600 --> 00:00:49,320 Hit enter. 13 00:00:49,860 --> 00:00:51,510 We get three rows affected. 14 00:00:51,900 --> 00:00:53,250 Three rows changed. 15 00:00:53,670 --> 00:01:00,660 Now if we go back and run our same select, we should see all polo shirts are now largest. 16 00:01:01,670 --> 00:01:05,510 We can do the same thing just to see it in the grand scheme of things. 17 00:01:08,140 --> 00:01:08,690 There we go. 18 00:01:08,710 --> 00:01:11,050 We have three largest now all polo shirts. 19 00:01:12,640 --> 00:01:19,300 The next problem is to update the shirt last worn 15 days ago and change the last one to be zero. 20 00:01:20,110 --> 00:01:30,490 So we'll start by just selecting that shirt like we did earlier where last worn equals 15. 21 00:01:32,140 --> 00:01:32,710 There it is. 22 00:01:32,710 --> 00:01:33,890 Tank top blue. 23 00:01:33,910 --> 00:01:34,540 Medium. 24 00:01:34,540 --> 00:01:36,190 Last, worn 15 days ago. 25 00:01:36,640 --> 00:01:38,260 And we wore it today. 26 00:01:38,380 --> 00:01:39,160 It was a hot day. 27 00:01:39,170 --> 00:01:40,300 We needed a tank top. 28 00:01:40,300 --> 00:01:42,970 And we want to update last one to be zero. 29 00:01:44,110 --> 00:01:55,210 So update shirts set last worn equal to zero where last worn is currently 15. 30 00:01:56,710 --> 00:01:59,500 We get one row affected, one changed. 31 00:02:00,280 --> 00:02:01,780 Let's do our select again. 32 00:02:02,410 --> 00:02:03,700 We no longer have it. 33 00:02:03,760 --> 00:02:08,139 But now if we say select where last one is zero, we have two shirts. 34 00:02:08,590 --> 00:02:13,180 This t shirt that was already there in our blue tank top, we just added perfect. 35 00:02:13,960 --> 00:02:20,920 So the final update is to update all white shirts, change their size to extra small and at the same 36 00:02:20,920 --> 00:02:22,930 time change their color to off white. 37 00:02:22,930 --> 00:02:24,370 So this needs to happen all at once. 38 00:02:24,370 --> 00:02:25,690 You can't do two lines. 39 00:02:25,690 --> 00:02:28,300 I mean, you could, but that's against the rules for this problem. 40 00:02:29,200 --> 00:02:30,070 So. 41 00:02:30,820 --> 00:02:33,880 Let's start off by just selecting all white shirts. 42 00:02:35,530 --> 00:02:40,660 Select star from shirts where color equals white. 43 00:02:42,550 --> 00:02:43,300 Oh, boy. 44 00:02:44,730 --> 00:02:46,870 Let's get rid of that extra l there. 45 00:02:46,900 --> 00:02:47,760 Here we go. 46 00:02:47,770 --> 00:02:48,400 So we have to. 47 00:02:48,400 --> 00:02:49,690 Shirt's a t shirt. 48 00:02:49,690 --> 00:02:51,970 That's white, that's small, and a tank top. 49 00:02:51,970 --> 00:02:53,500 That's white, that's small. 50 00:02:53,890 --> 00: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 51 00:02:59,500 --> 00:03:02,740 we mix them with colored stuff in the washing machine. 52 00:03:02,740 --> 00:03:04,750 So their color is now off white. 53 00:03:05,740 --> 00:03:18,370 So to do that, let's start with the first part update shirts and we'll set color to be off white and 54 00:03:18,370 --> 00:03:21,520 then we'll do the second part with a comma. 55 00:03:21,640 --> 00:03:27,760 Shirt size equals X extra small just like that. 56 00:03:28,570 --> 00:03:37,000 And then we'll do our wear color currently equals white and that should do it. 57 00:03:37,150 --> 00:03:38,200 Fingers crossed. 58 00:03:38,500 --> 00:03:39,520 No typos. 59 00:03:40,120 --> 00:03:44,830 Now, if we go back and select where color is white, we should have nothing. 60 00:03:45,670 --> 00:03:50,710 But if we say we're color is off white, we should have two that are extra smalls. 61 00:03:50,800 --> 00:03:55,030 Or we could of course do select star from shirts to check our work. 62 00:03:55,030 --> 00:03:58,450 We have extra small off white, extra small off white. 63 00:03:59,170 --> 00:04:04,660 So that problem is just making sure that you could update multiple fields at once, making sure you 64 00:04:04,660 --> 00:04:05,530 understood that. 65 00:04:06,700 --> 00:04:07,780 That's it for update. 66 00:04:07,780 --> 00:04:10,210 Next, we move on to d delete.