1 00:00:00,090 --> 00:00:03,270 The next thing we need to know about tables is how to get rid of them. 2 00:00:03,270 --> 00:00:04,860 How do we delete a table? 3 00:00:05,100 --> 00:00:07,610 Well, we use a drop table command. 4 00:00:07,620 --> 00:00:09,840 Remember, there was drop database that drops. 5 00:00:09,840 --> 00:00:13,620 An entire database will drop table just drops a single table. 6 00:00:13,620 --> 00:00:19,050 But you still need to be very careful with it because if your table has a lot of information in it, 7 00:00:19,050 --> 00:00:20,490 you can lose all of that. 8 00:00:20,520 --> 00:00:21,540 It doesn't stop you. 9 00:00:21,540 --> 00:00:24,870 It doesn't ask, Are you sure it's just going to drop that table? 10 00:00:24,900 --> 00:00:27,450 So our tables right now are empty, right? 11 00:00:27,600 --> 00:00:30,330 If we do show tables, both of them are empty. 12 00:00:30,330 --> 00:00:31,500 That's not proof that they're empty. 13 00:00:31,500 --> 00:00:32,729 But we know they're empty. 14 00:00:32,910 --> 00:00:35,460 If I want to drop one of them, let's drop cats. 15 00:00:35,490 --> 00:00:38,850 Drop table cats, semicolon. 16 00:00:39,390 --> 00:00:40,310 And that's it. 17 00:00:40,320 --> 00:00:42,030 It didn't give me a heads up or anything. 18 00:00:42,030 --> 00:00:42,780 It's just gone. 19 00:00:42,780 --> 00:00:45,960 If I do show tables now, we only have dogs. 20 00:00:45,960 --> 00:00:52,770 If I refresh the table view over here in one of my graphical user interfaces, we only see dogs. 21 00:00:52,860 --> 00:00:53,550 Same thing here. 22 00:00:53,550 --> 00:00:58,590 If I refresh, we only see dogs inside of pet shop, if you can see that at all. 23 00:00:58,590 --> 00:00:59,460 It's so tiny. 24 00:00:59,880 --> 00:01:06,420 Now another way of deleting a table from one within one of these user interfaces is to right click. 25 00:01:06,420 --> 00:01:09,660 This is in DB gates, right click on the table. 26 00:01:09,660 --> 00:01:16,230 I can click drop table and then it's going to create this little bit of code for me and then I can run 27 00:01:16,230 --> 00:01:17,280 that code if I want to. 28 00:01:17,280 --> 00:01:20,640 But you'll notice it says drop table inside of there. 29 00:01:21,570 --> 00:01:24,930 I assume on workbench we can do something very similar. 30 00:01:25,690 --> 00:01:26,350 Right there. 31 00:01:26,350 --> 00:01:28,780 Drop table if I want to drop the dogs table. 32 00:01:29,170 --> 00:01:33,080 This will ask me to review the SQL or just click drop now. 33 00:01:33,100 --> 00:01:34,540 I'll just click drop now. 34 00:01:34,540 --> 00:01:36,100 And now that table is gone. 35 00:01:36,430 --> 00:01:42,640 Now, I hope you're not dropping lots of tables all the time, but if you do drop a table, I always 36 00:01:42,640 --> 00:01:48,340 say, Well, I don't always say, but I would always recommend that you take a moment to think about 37 00:01:48,340 --> 00:01:50,260 what's in that in that table. 38 00:01:50,380 --> 00:01:56,940 Maybe once we learn how to view the contents, run that first and then drop a table. 39 00:01:56,950 --> 00:02:00,910 But that's my fault for showing you how to drop a table before we can even check what's in them. 40 00:02:01,390 --> 00:02:02,800 But for now, that's all you need to know. 41 00:02:02,800 --> 00:02:07,690 Drop a table using drop space table and the table name and it is gone. 42 00:02:07,690 --> 00:02:08,169 Gone. 43 00:02:08,169 --> 00:02:08,990 Really gone. 44 00:02:09,009 --> 00:02:09,970 It's not coming back.