1 00:00:00,390 --> 00:00:01,609 So we've made it to the end. 2 00:00:01,620 --> 00:00:06,210 The final video solution to our spring cleaning extravaganza problem. 3 00:00:06,510 --> 00:00:07,680 Now we need to delete. 4 00:00:07,689 --> 00:00:13,450 We've covered creating, reading and updating, basically inserting, selecting and update. 5 00:00:13,470 --> 00:00:15,120 Now we're going to use delete. 6 00:00:15,150 --> 00:00:22,050 So the first thing is to delete all old shirts, which really just in this case means last worn is 200. 7 00:00:22,050 --> 00:00:22,830 Exactly. 8 00:00:24,330 --> 00:00:30,780 So when we do our select star, you can see there's two shirts that meet that criteria, seven ID of 9 00:00:30,780 --> 00:00:36,330 seven and ID of two, but we're going to delete them based off of last one. 10 00:00:36,540 --> 00:00:46,350 So we always start with our select star from shirts where last one equals 200. 11 00:00:47,940 --> 00:00:49,200 When we get our two shirts. 12 00:00:49,830 --> 00:00:54,870 So then we can copy this and actually we can copy this entire thing. 13 00:00:54,900 --> 00:01:01,650 Delete from shirts where last worn is 202 rows affected. 14 00:01:01,800 --> 00:01:06,090 Now if we do a select star, those two are gone. 15 00:01:06,120 --> 00:01:11,730 You can see it goes from 1 to 3 and then from 6 to 8 and there we go. 16 00:01:12,180 --> 00:01:15,810 So the next problem is to delete all tank tops. 17 00:01:15,960 --> 00:01:19,290 We've decided tank tops make us look kind of stupid. 18 00:01:19,290 --> 00:01:21,030 So we're going to delete tank tops. 19 00:01:21,330 --> 00:01:23,040 So your tastes have changed. 20 00:01:23,040 --> 00:01:24,840 So how many tank tops do we have? 21 00:01:24,870 --> 00:01:27,810 We've got one and two that are left. 22 00:01:28,410 --> 00:01:37,260 So we'll do a select star from shirts where article equals tank top we get to. 23 00:01:38,020 --> 00:01:45,400 Then all we need to do now is delete from shirts where article equals tank top. 24 00:01:46,210 --> 00:01:46,960 Hit enter. 25 00:01:48,670 --> 00:01:50,980 Now, if we try and select them, they're gone. 26 00:01:50,980 --> 00:01:58,150 And if we do a select star from shirts with no where clause, now we have one, three, five, six, 27 00:01:58,150 --> 00:01:58,570 nine. 28 00:01:58,570 --> 00:02:00,130 So we've lost our two tank tops. 29 00:02:00,130 --> 00:02:02,230 All we have are T-shirts and polo shirts. 30 00:02:02,590 --> 00:02:05,680 Which leads us to our final exercise here. 31 00:02:06,220 --> 00:02:09,340 Delete all the shirts and I lie to to actually the second to last. 32 00:02:09,340 --> 00:02:13,510 So to delete all the shirts, but not the entire table, it's pretty simple. 33 00:02:14,950 --> 00:02:20,170 We use the same word clause which which is to say that we don't have a wear clause. 34 00:02:20,170 --> 00:02:22,900 So in this case it returns select star from shirts. 35 00:02:22,900 --> 00:02:24,370 Returns all shirts. 36 00:02:24,490 --> 00:02:29,620 Well, we just replace that delete from shirts. 37 00:02:30,580 --> 00:02:33,250 If I can spell it correctly with this part. 38 00:02:34,680 --> 00:02:36,240 And moment of truth. 39 00:02:36,630 --> 00:02:38,100 Five rows affected. 40 00:02:38,460 --> 00:02:41,340 Now, when they do select star from shirts, we get nothing. 41 00:02:43,020 --> 00:02:43,890 It's a sad day. 42 00:02:44,190 --> 00:02:46,650 Not as sad as when he deleted the cats, but still sad. 43 00:02:47,340 --> 00:02:50,430 And the last thing is to drop the entire shirts table. 44 00:02:50,550 --> 00:02:52,070 We're just done with this. 45 00:02:52,080 --> 00:02:53,570 We hated this exercise. 46 00:02:53,580 --> 00:02:54,660 We want to move on. 47 00:02:55,170 --> 00:03:00,060 So drop table shirts now. 48 00:03:00,090 --> 00:03:00,840 Hit enter. 49 00:03:02,010 --> 00:03:11,460 And if I do show tables, no tables, and if I try and describe shirts, we get an error because there 50 00:03:11,460 --> 00:03:14,310 is no shirts table to describe and it freaks out. 51 00:03:14,580 --> 00:03:16,110 So we've successfully deleted it. 52 00:03:16,110 --> 00:03:20,440 Now we have an empty database that we don't need anymore, and we're done with this. 53 00:03:20,460 --> 00:03:21,510 Congratulations.