1 00:00:00,330 --> 00:00:01,810 Hello and welcome. 2 00:00:01,860 --> 00:00:03,160 In this ft you. 3 00:00:03,240 --> 00:00:13,840 We will use the rescue will create command to create a table before we create the table. 4 00:00:13,860 --> 00:00:24,810 There are a few guidelines that we need to be aware of table names must begin with a letter and they 5 00:00:24,810 --> 00:00:33,720 must have a character between one and 30 characters long so the character limit should be between one 6 00:00:33,840 --> 00:00:35,140 and 30. 7 00:00:35,250 --> 00:00:40,780 Long table names can contain a tizzy. 8 00:00:40,920 --> 00:00:45,830 Anything from eight to see either of part or lower case. 9 00:00:46,350 --> 00:00:57,630 They can also contain numbers 0 9 they can contain a negative sign that can contain a dollar sign and 10 00:00:58,140 --> 00:01:04,990 pound sign or hash tag sign table names can not be duplicate names. 11 00:01:05,000 --> 00:01:16,520 For example you can't name a table with a name that already exist within the same schema. 12 00:01:17,280 --> 00:01:25,080 For example I think we are working on the here Charles scheme which comes with the Oracle database. 13 00:01:25,080 --> 00:01:29,340 We can't have duplicate names within that schema. 14 00:01:29,730 --> 00:01:32,880 So there is a table quote employees. 15 00:01:32,880 --> 00:01:39,290 I can't go ahead and create another table quote employees within the same scheme. 16 00:01:39,780 --> 00:01:46,290 We cannot use a reserve name or reserve word to create a table. 17 00:01:46,290 --> 00:01:56,220 For example we can't use the word select or from or way those are reserved key words that me obscure 18 00:01:56,220 --> 00:02:02,050 language he uses so we can't use them to create tables. 19 00:02:02,100 --> 00:02:05,910 I have got to add for a court editor opened. 20 00:02:06,150 --> 00:02:12,760 I am going to create a table and am going to give the table name destination. 21 00:02:12,780 --> 00:02:18,830 I am also going to create a quasi trained constraint within the table. 22 00:02:19,110 --> 00:02:27,990 What the constraint will do is that it will enforce some kind of rule on that table so to create a table 23 00:02:27,990 --> 00:02:35,580 you start with the table so to create a table you type in bickie would create 24 00:02:39,600 --> 00:02:43,460 space and then type in table. 25 00:02:45,590 --> 00:02:46,690 Then typing. 26 00:02:46,710 --> 00:02:52,130 If you are not in the same schema as the table you are trying to create. 27 00:02:52,140 --> 00:02:55,060 You need to specify it was schema. 28 00:02:55,140 --> 00:02:57,680 You are creating the table in. 29 00:02:57,870 --> 00:03:04,830 So I was specify here char even do i mean hey char schema is good practice so you get the hang of it 30 00:03:05,490 --> 00:03:15,270 and then after B scheme you specify dot and then you type in the table name. 31 00:03:16,260 --> 00:03:25,560 So I'm creating a table of destination half defining D table name. 32 00:03:25,560 --> 00:03:30,240 Next line you need to place to Para. 33 00:03:30,280 --> 00:03:40,710 Pieces left and right and then in-between is where you will insert B values for this table. 34 00:03:40,770 --> 00:03:42,920 So I do this as separate. 35 00:03:43,220 --> 00:03:47,790 And then in between you come there and specify the columns. 36 00:03:47,790 --> 00:03:51,510 So the first column I wanted to be a destination. 37 00:03:51,540 --> 00:03:54,240 A D. 38 00:04:01,140 --> 00:04:05,940 Then I need to give it the data type. 39 00:04:05,940 --> 00:04:08,400 What type of data is it going to be. 40 00:04:08,400 --> 00:04:09,890 Is going to be in number. 41 00:04:09,930 --> 00:04:19,860 So our number will be the data type and the value will be 6. 42 00:04:20,350 --> 00:04:27,660 While it's six main things that the names are decimal places so you can have numbers up to the value 43 00:04:27,660 --> 00:04:36,740 of six decimal places so that the first column second column I am going to call ctd 44 00:04:39,660 --> 00:04:47,580 and then the data type will be varchar var child to varchar to is the data type. 45 00:04:47,670 --> 00:04:54,950 So when specifying columns you need to specify what type of data that's going to go in there. 46 00:04:54,960 --> 00:05:05,400 This is going to be a varchar to and then going to give it a value of 25 bytes 47 00:05:09,000 --> 00:05:18,720 and then I'm going to give one a set the constraint in that column so that the column is not novel. 48 00:05:18,750 --> 00:05:25,830 That means a data more something of value must be put in to that column. 49 00:05:25,840 --> 00:05:32,010 When creating importing values so you do a constraint within them constraint 50 00:05:35,700 --> 00:05:37,870 followed by ID in name of the constraint. 51 00:05:37,890 --> 00:05:42,450 It's good to name your constraint that relevant to the column so you know. 52 00:05:42,750 --> 00:05:44,660 Makes it easy for you to identify. 53 00:05:44,670 --> 00:05:46,970 So I'll go see to 54 00:05:49,320 --> 00:05:50,980 underscore. 55 00:05:52,810 --> 00:05:54,060 Name. 56 00:05:54,940 --> 00:05:58,510 And then you set the value the value is not 57 00:06:01,420 --> 00:06:08,580 not a lot lower means it means it can not be empty of value must be put in there. 58 00:06:09,130 --> 00:06:19,480 Okay so the neg's column always separate your values with a comma when creating tables have after of 59 00:06:19,480 --> 00:06:20,770 first column. 60 00:06:20,770 --> 00:06:24,980 You put a comma second one comma. 61 00:06:25,710 --> 00:06:29,170 Then the file or column pull is table. 62 00:06:29,680 --> 00:06:32,570 It's going to be called country. 63 00:06:33,240 --> 00:06:41,370 And I want this to be a varchar of two data type. 64 00:06:41,470 --> 00:06:46,190 I'm giving it 45 bytes. 65 00:06:52,050 --> 00:06:56,730 Finnicky noted the last column doesn't need a comma because I'm done. 66 00:06:56,810 --> 00:07:03,540 And then you end with the same I call on very important. 67 00:07:03,550 --> 00:07:08,220 So the script is being written to create a table. 68 00:07:08,460 --> 00:07:14,670 So all I need to do is execute and the table will be inserted into the database. 69 00:07:14,990 --> 00:07:17,110 So these are the columns for the table. 70 00:07:17,120 --> 00:07:22,180 They are enclosed inside parenthesis left and right is very important. 71 00:07:22,190 --> 00:07:23,540 You see that they match up. 72 00:07:23,540 --> 00:07:28,880 That's why the green is highlighted and then end your statement with a semicolon. 73 00:07:28,880 --> 00:07:30,050 Very important. 74 00:07:30,200 --> 00:07:35,070 So you use the create table keyword to create a table. 75 00:07:35,360 --> 00:07:40,830 Specifies this schema where the table is going to be created. 76 00:07:42,560 --> 00:07:47,450 These are not really necessary because I am already in the schema. 77 00:07:47,630 --> 00:07:48,500 Not see it there. 78 00:07:48,500 --> 00:07:50,010 I mean the H R scheme. 79 00:07:50,020 --> 00:07:54,190 But is good practice to specify that an I'm giving. 80 00:07:54,320 --> 00:08:02,750 The giving it the table three columns first one destination underscore eidy we to date a type of number 81 00:08:03,290 --> 00:08:13,130 and he can take up to six values six digits in the second column here city with a voucher to take 25 82 00:08:13,130 --> 00:08:21,000 bytes a set of constraint within named city underscore name and value not not means. 83 00:08:21,110 --> 00:08:24,500 This is collomb here can cannot be empty. 84 00:08:24,500 --> 00:08:31,310 You must put something in there and then finally a goal column called Country bar chart two point five 85 00:08:31,310 --> 00:08:32,480 bytes are less common. 86 00:08:32,480 --> 00:08:39,700 This data you could execute 3 that says table created table created. 87 00:08:39,830 --> 00:08:47,720 So we have successfully created a table so to check that out to a select on the table select 88 00:08:51,440 --> 00:08:54,420 are from. 89 00:08:56,190 --> 00:08:59,640 Destination. 90 00:09:00,820 --> 00:09:03,970 So what this would do it would bring all the record from that table. 91 00:09:04,060 --> 00:09:05,740 It should be empty at the moment. 92 00:09:06,020 --> 00:09:06,700 Excellent. 93 00:09:06,700 --> 00:09:07,570 We've got three. 94 00:09:07,580 --> 00:09:08,310 Three o'clock. 95 00:09:08,330 --> 00:09:11,720 Destination city country derived from. 96 00:09:11,750 --> 00:09:16,330 So we have successfully created it in this video. 97 00:09:16,340 --> 00:09:22,760 We created a table brandnew table in the h.r. schema. 98 00:09:23,300 --> 00:09:30,290 We give you a table three columns and we set to datatypes for the columns. 99 00:09:30,290 --> 00:09:34,990 And we successfully committed. 100 00:09:35,000 --> 00:09:42,590 When you create a table or you create anything on the database once you've executed it. 101 00:09:42,890 --> 00:09:44,770 You must also commit. 102 00:09:44,810 --> 00:09:47,820 This is a comet botin is very important. 103 00:09:47,840 --> 00:09:48,680 We don't comment. 104 00:09:48,710 --> 00:09:52,090 It's not permanent so click it. 105 00:09:52,820 --> 00:10:00,140 So once you've committed you can't roll back but when you don't come it is easy to roll back to what 106 00:10:00,140 --> 00:10:07,280 you've done so because I've now committed the data table to the database it's now permanent. 107 00:10:07,280 --> 00:10:13,670 So if you're not sure you want something to be permanent don't commit it for boys good practice to always 108 00:10:13,670 --> 00:10:17,710 complete your work was you sure you wanted it to go in. 109 00:10:17,900 --> 00:10:23,710 So now comito that the table now is permanent or less is deleted. 110 00:10:23,780 --> 00:10:25,450 So thank you so much for watching. 111 00:10:25,460 --> 00:10:33,100 I hope the video has been useful in helping you to learn how to create a table using the excuse. 112 00:10:33,140 --> 00:10:34,800 Create command. 113 00:10:34,970 --> 00:10:37,140 Thank you and bye for now.