1 00:00:00,180 --> 00:00:03,270 It's time for you to practice creating and dropping your own table. 2 00:00:03,300 --> 00:00:04,350 This will be quick. 3 00:00:04,470 --> 00:00:05,290 Here we are. 4 00:00:05,310 --> 00:00:06,030 Instructions. 5 00:00:06,030 --> 00:00:09,630 I'd like you to create a pastries table called pastries. 6 00:00:09,630 --> 00:00:11,430 And it has two columns. 7 00:00:11,520 --> 00:00:13,800 A name and a quantity. 8 00:00:13,830 --> 00:00:15,960 Name should be the name of a pastry. 9 00:00:17,430 --> 00:00:18,270 What's a pastry? 10 00:00:18,360 --> 00:00:19,770 Muffin, croissant. 11 00:00:20,160 --> 00:00:23,700 And then also the quantity, which should be a number. 12 00:00:23,730 --> 00:00:24,570 An integer. 13 00:00:24,960 --> 00:00:27,330 So create that and then inspect it. 14 00:00:27,330 --> 00:00:29,250 Make sure those columns exist. 15 00:00:29,760 --> 00:00:34,440 I said in the class and the command line, if you're not using the command line, then just inspect 16 00:00:34,440 --> 00:00:36,770 it, using the workbench or some other tool. 17 00:00:36,780 --> 00:00:40,670 Make sure those columns and types are correct and then delete the table. 18 00:00:40,680 --> 00:00:41,570 So posit. 19 00:00:41,610 --> 00:00:42,720 Try this on your own. 20 00:00:42,720 --> 00:00:47,730 Hopefully it just takes you a minute or two and here is a solution. 21 00:00:47,910 --> 00:00:50,460 So I'm going to run a create table. 22 00:00:50,490 --> 00:00:53,040 I'll just do it in my database I'm currently using. 23 00:00:53,040 --> 00:00:55,200 So I'm going to drop the table immediately after. 24 00:00:55,200 --> 00:01:01,380 So create table pastries and then I need parentheses somewhere. 25 00:01:02,040 --> 00:01:03,090 I'll do it on one line. 26 00:01:03,090 --> 00:01:04,200 Let's see if it fits. 27 00:01:04,200 --> 00:01:13,290 So Pastries is going to have name, which is supposed to be text up to 50 characters, var char 50 and 28 00:01:13,290 --> 00:01:18,450 then it would need to have quantity, which is an integer quantity int. 29 00:01:19,330 --> 00:01:20,380 Just like that. 30 00:01:20,380 --> 00:01:22,020 I'm missing a closing, Perrin. 31 00:01:22,600 --> 00:01:24,690 It's already looking bad on a single line. 32 00:01:24,700 --> 00:01:26,290 It'd be better to put some returns in there. 33 00:01:26,290 --> 00:01:28,270 But this should work, right. 34 00:01:28,300 --> 00:01:29,260 Create table pastries. 35 00:01:29,260 --> 00:01:30,070 Opening Perrin. 36 00:01:30,070 --> 00:01:30,460 Closing. 37 00:01:30,460 --> 00:01:31,120 Perrin. 38 00:01:31,180 --> 00:01:32,450 Name is of our car. 39 00:01:32,470 --> 00:01:34,180 50 up to 50 characters. 40 00:01:34,180 --> 00:01:37,000 Quantity is an integer and it looks like it worked. 41 00:01:37,000 --> 00:01:37,780 How do we know? 42 00:01:38,080 --> 00:01:39,160 First step. 43 00:01:39,220 --> 00:01:40,960 We could do show tables. 44 00:01:40,960 --> 00:01:41,830 There it is. 45 00:01:41,830 --> 00:01:42,700 Pastries. 46 00:01:42,700 --> 00:01:43,570 What else can we do? 47 00:01:43,600 --> 00:01:46,090 We can describe pastries. 48 00:01:46,900 --> 00:01:47,760 And there we are. 49 00:01:47,770 --> 00:01:49,300 Name is of our car 50. 50 00:01:49,330 --> 00:01:50,920 Quantity is an integer. 51 00:01:51,250 --> 00:01:55,930 And then, of course, we can use one of our tools and refresh the tables. 52 00:01:55,930 --> 00:01:57,070 And we should see pastries. 53 00:01:57,070 --> 00:01:57,600 Is here. 54 00:01:57,610 --> 00:02:00,400 Name of our car 50 quantity integer. 55 00:02:00,400 --> 00:02:02,770 Same thing in the workbench refresh. 56 00:02:02,860 --> 00:02:06,940 I'm not going to keep doing this throughout the whole course, showing you every option, but it's still 57 00:02:06,940 --> 00:02:07,720 early on. 58 00:02:07,720 --> 00:02:14,950 So instead of tables we see pastries and down here it says name var 50 quantity int and then the last 59 00:02:14,950 --> 00:02:16,540 thing we'll do is delete the table. 60 00:02:16,540 --> 00:02:22,030 So I'm going to do that from the command line, drop table pastries and we know it worked. 61 00:02:22,030 --> 00:02:24,460 If I try and describe that table, we get an error. 62 00:02:24,460 --> 00:02:28,030 If I do show tables, it's empty. 63 00:02:28,210 --> 00:02:30,790 If I refresh over here, it's gone. 64 00:02:31,690 --> 00:02:36,550 So that's our first little basic exercise creating a table, inspecting it and dropping it.