1 00:00:00,180 --> 00:00:00,660 All right. 2 00:00:00,660 --> 00:00:03,020 It's the final piece of this exercise solution. 3 00:00:03,030 --> 00:00:05,370 Let's delete all old shirts. 4 00:00:05,370 --> 00:00:10,560 So old, in our case just means more than 200 days ago, which is a very specific number. 5 00:00:10,560 --> 00:00:14,700 We haven't yet seen how to delete things that are not exact matches. 6 00:00:14,700 --> 00:00:19,680 So things that are older than 200 days ago, what about 205 to 50? 7 00:00:19,680 --> 00:00:20,570 400? 8 00:00:20,580 --> 00:00:25,950 Well, it's convenient for us that we don't have any of those values in our database, but we will learn 9 00:00:25,950 --> 00:00:26,490 how to do that. 10 00:00:26,490 --> 00:00:28,980 But for now, that's not what I'm looking for at the moment. 11 00:00:28,980 --> 00:00:35,970 I just want us to delete everything that is exactly 200 days or last worn is exactly 200 days. 12 00:00:36,420 --> 00:00:38,070 So delete. 13 00:00:38,250 --> 00:00:42,420 Don't forget the from a lot of people forget the from delete from shirts. 14 00:00:42,420 --> 00:00:46,920 And I'm kind of breaking my rule because I said I like to select first and make sure. 15 00:00:46,920 --> 00:00:52,140 So let's do that select start from shirts where last. 16 00:00:52,960 --> 00:00:55,660 One equals to 100. 17 00:00:55,690 --> 00:00:57,670 The there are the two shirts. 18 00:00:57,670 --> 00:01:05,500 So instead of selecting, of course we are going to delete from shirts where last one is 200. 19 00:01:05,740 --> 00:01:07,600 Let's do a select star from shirts. 20 00:01:07,600 --> 00:01:11,000 And we should see we've lost a couple of shirts, right? 21 00:01:11,020 --> 00:01:13,120 We don't have any of those old shirts anymore. 22 00:01:13,150 --> 00:01:14,250 What's next? 23 00:01:14,260 --> 00:01:16,210 Deletes all our tank tops. 24 00:01:16,210 --> 00:01:18,400 We can't be caught dead in a tank top anymore. 25 00:01:18,850 --> 00:01:24,700 So once again, select first star from shirts where article. 26 00:01:24,700 --> 00:01:29,680 And in this case, this is a sort of thing that is definitely useful to test first, because I don't 27 00:01:29,680 --> 00:01:34,180 remember if it's tank dash, top tank, top tank, top one word. 28 00:01:34,360 --> 00:01:36,970 All right, this is it, tank space top. 29 00:01:37,480 --> 00:01:39,340 So we see that's what I'm expecting. 30 00:01:39,340 --> 00:01:40,750 I want to delete that. 31 00:01:40,750 --> 00:01:49,120 So then instead of selecting star from, we simply delete from now, if we look for just let's just 32 00:01:49,120 --> 00:01:51,400 select star, we should see no tank tops. 33 00:01:51,400 --> 00:01:56,380 I could also just try and select where article is tank top and we should get an empty set. 34 00:01:56,380 --> 00:01:58,180 There are no matching rows. 35 00:01:59,580 --> 00:02:02,070 Now we're going to delete all the shirts from the table. 36 00:02:02,100 --> 00:02:03,390 Not the entire table. 37 00:02:03,420 --> 00:02:04,200 Keep the table. 38 00:02:04,230 --> 00:02:05,190 Delete the shirts. 39 00:02:05,610 --> 00:02:08,130 Simple deletes from shirts. 40 00:02:08,789 --> 00:02:09,479 Goodbye. 41 00:02:09,479 --> 00:02:10,440 All my shirts. 42 00:02:10,440 --> 00:02:15,540 So the table is still there, but it's empty so I can still describe it. 43 00:02:15,930 --> 00:02:18,210 We don't get an error, but it's empty. 44 00:02:19,050 --> 00:02:20,110 But not for long. 45 00:02:20,130 --> 00:02:21,450 Soon it's going to be gone. 46 00:02:21,450 --> 00:02:23,820 Not just empty, but non-existent. 47 00:02:23,820 --> 00:02:25,890 We're going to drop the entire shirts table. 48 00:02:25,890 --> 00:02:27,390 My closet burned down or something. 49 00:02:27,390 --> 00:02:28,070 I don't know. 50 00:02:28,080 --> 00:02:34,980 Or maybe I just realized it was a stupid idea to put a database to track all my shirts. 51 00:02:34,980 --> 00:02:39,630 So all we do here is drop table shirts, goodbye shirts. 52 00:02:39,840 --> 00:02:42,090 And now I can't describe shirts. 53 00:02:42,090 --> 00:02:43,350 It doesn't exist. 54 00:02:43,500 --> 00:02:45,660 All records are erased. 55 00:02:45,690 --> 00:02:47,550 No trace of my shirts, endeavor. 56 00:02:47,550 --> 00:02:50,220 And that's it for this basic CRUD challenge.