1
00:00:00,620 --> 00:00:02,719
All right, so let's create a table.

2
00:00:04,440 --> 00:00:12,060
If you remember to go to our postgresql at abase, we simply write Pascual and then our database name

3
00:00:12,780 --> 00:00:17,840
and we'll enter the database and now we can communicate with it using school.

4
00:00:18,300 --> 00:00:19,490
Now let's create a table.

5
00:00:19,980 --> 00:00:20,790
How can we do that?

6
00:00:21,810 --> 00:00:27,930
Again, ask you all comes with some language, language, syntax that we can use and to create a table.

7
00:00:29,010 --> 00:00:36,180
We can use something like this, we say Create Table, which is Enescu document, we enter a table name

8
00:00:37,110 --> 00:00:38,640
followed by Brackett's.

9
00:00:39,850 --> 00:00:46,720
And then we say what we want to call them, want to say with the data type column to with the data type

10
00:00:46,720 --> 00:00:51,130
column three with the data type and then ending it with semi call it.

11
00:00:52,840 --> 00:00:54,960
Let me just press enter and see what happens here.

12
00:00:56,030 --> 00:01:05,030
I get an air type data type does not exist, and that is because data type is referring to what postcrisis

13
00:01:05,030 --> 00:01:08,000
or are relational database knows.

14
00:01:08,010 --> 00:01:14,240
We have to say ahead of time what type of data column one column to in column three hold.

15
00:01:15,450 --> 00:01:22,980
If we go back to our Chrome browser, we see that for progress, we have a few data types that we can

16
00:01:22,980 --> 00:01:28,920
hold string data types, numeric data types and date and time data types.

17
00:01:29,190 --> 00:01:31,230
And each one of them have different things.

18
00:01:31,530 --> 00:01:37,690
For a numeric data type, we have integer, which is a four byte integer.

19
00:01:37,860 --> 00:01:43,890
We have big to which allows for a bigger number and all these different things.

20
00:01:43,890 --> 00:01:46,020
We have even money, which is currency value.

21
00:01:46,560 --> 00:01:51,420
And the reason we have to give this data type is because of the way databases work.

22
00:01:51,660 --> 00:01:57,870
They're optimized to make sure that as long as everything is the same in their column, they're able

23
00:01:57,870 --> 00:02:00,600
to work really, really fast to perform actions.

24
00:02:02,030 --> 00:02:04,910
In our case, let's use some of the most common ones.

25
00:02:06,390 --> 00:02:11,290
We can use text for the first column, so let's do that.

26
00:02:11,310 --> 00:02:15,490
I'm going to press the up arrow and get create table.

27
00:02:15,960 --> 00:02:19,110
I'm also going to name this table, let's call it.

28
00:02:20,590 --> 00:02:21,220
Users.

29
00:02:23,970 --> 00:02:27,150
And column one will be name.

30
00:02:28,700 --> 00:02:30,650
Data type can be.

31
00:02:33,570 --> 00:02:36,750
Column two, we can say that is H.

32
00:02:37,900 --> 00:02:40,030
And data type for an age.

33
00:02:40,240 --> 00:02:47,350
Well, if we look down here, we look at numeric types, we want to use something like Småland, which

34
00:02:47,350 --> 00:02:49,430
is a two bite sized integer.

35
00:02:49,930 --> 00:02:56,230
It means that Max, for a small int if I go to small int Max.

36
00:02:58,840 --> 00:03:03,020
We see that the max range is thirty two thousand seven hundred sixty two.

37
00:03:03,040 --> 00:03:04,780
Well, nobody is going to be that.

38
00:03:04,780 --> 00:03:05,320
All right.

39
00:03:05,440 --> 00:03:07,000
So we can use small and for now.

40
00:03:09,080 --> 00:03:09,710
Let's do that.

41
00:03:09,920 --> 00:03:12,250
I'm going to say ages small and.

42
00:03:14,130 --> 00:03:23,970
And finally, the third column we'll just have birthday and birthday can be a date data type and we

43
00:03:23,970 --> 00:03:25,470
can just have a date.

44
00:03:27,510 --> 00:03:28,290
Let's press enter.

45
00:03:29,900 --> 00:03:31,040
And I get create table.

46
00:03:32,490 --> 00:03:36,270
Let's look at our school here and minimize this.

47
00:03:37,730 --> 00:03:39,440
And if I click refresh here.

48
00:03:40,920 --> 00:03:49,460
I see that we have users look at that and we have columns for the table users, that is name, age,

49
00:03:49,470 --> 00:03:49,990
birthday.

50
00:03:50,400 --> 00:03:52,990
It tells us the type and the length.

51
00:03:53,010 --> 00:03:54,860
So now we have our table.

52
00:03:55,260 --> 00:03:55,630
Awesome.

53
00:03:56,400 --> 00:04:00,360
There's also a way to do it here if we do backslash D.

54
00:04:02,940 --> 00:04:07,920
I get lists of relations and look at that, we have our user stable.

55
00:04:09,040 --> 00:04:10,360
And the owner, which is me.

56
00:04:11,580 --> 00:04:11,880
Michael.

57
00:04:13,480 --> 00:04:14,050
There you go.

58
00:04:14,170 --> 00:04:20,200
We've created our first table now that we have this, we can start entering some information.

59
00:04:20,500 --> 00:04:24,440
And by the way, you might be asking, how many times do we run these commands?

60
00:04:24,940 --> 00:04:30,130
Well, ideally, once you create your database and it lives somewhere on a computer, somewhere in the

61
00:04:30,130 --> 00:04:30,460
world.

62
00:04:31,440 --> 00:04:38,190
You only run this once, right, you create a table of why you want your database to look like and the

63
00:04:38,190 --> 00:04:42,270
rest is just filling in and inserting information and reading information off of it.

64
00:04:43,080 --> 00:04:49,140
So this is the command that we're going to set up when we create our own database to set up our schemas.

65
00:04:49,350 --> 00:04:55,100
And then after that, it will just run on its own and it will be able to communicate with the back end.

66
00:04:55,650 --> 00:05:00,490
It's going to be very fun, by the way, before we get into the next video and show you one more command.

67
00:05:00,510 --> 00:05:03,330
We learned this lady shows us our tables.

68
00:05:03,930 --> 00:05:10,890
If I do cue, we exit out of here and we're back to the terminal.

69
00:05:12,440 --> 00:05:14,160
All right, I'll see you in the next one.

70
00:05:14,750 --> 00:05:15,080
Bye bye.

