All right, so let's create a table.
If you remember to go to our postgresql at abase, we simply write Pascual and then our database name
and we'll enter the database and now we can communicate with it using school.
Now let's create a table.
How can we do that?
Again, ask you all comes with some language, language, syntax that we can use and to create a table.
We can use something like this, we say Create Table, which is Enescu document, we enter a table name
followed by Brackett's.
And then we say what we want to call them, want to say with the data type column to with the data type
column three with the data type and then ending it with semi call it.
Let me just press enter and see what happens here.
I get an air type data type does not exist, and that is because data type is referring to what postcrisis
or are relational database knows.
We have to say ahead of time what type of data column one column to in column three hold.
If we go back to our Chrome browser, we see that for progress, we have a few data types that we can
hold string data types, numeric data types and date and time data types.
And each one of them have different things.
For a numeric data type, we have integer, which is a four byte integer.
We have big to which allows for a bigger number and all these different things.
We have even money, which is currency value.
And the reason we have to give this data type is because of the way databases work.
They're optimized to make sure that as long as everything is the same in their column, they're able
to work really, really fast to perform actions.
In our case, let's use some of the most common ones.
We can use text for the first column, so let's do that.
I'm going to press the up arrow and get create table.
I'm also going to name this table, let's call it.
Users.
And column one will be name.
Data type can be.
Column two, we can say that is H.
And data type for an age.
Well, if we look down here, we look at numeric types, we want to use something like Småland, which
is a two bite sized integer.
It means that Max, for a small int if I go to small int Max.
We see that the max range is thirty two thousand seven hundred sixty two.
Well, nobody is going to be that.
All right.
So we can use small and for now.
Let's do that.
I'm going to say ages small and.
And finally, the third column we'll just have birthday and birthday can be a date data type and we
can just have a date.
Let's press enter.
And I get create table.
Let's look at our school here and minimize this.
And if I click refresh here.
I see that we have users look at that and we have columns for the table users, that is name, age,
birthday.
It tells us the type and the length.
So now we have our table.
Awesome.
There's also a way to do it here if we do backslash D.
I get lists of relations and look at that, we have our user stable.
And the owner, which is me.
Michael.
There you go.
We've created our first table now that we have this, we can start entering some information.
And by the way, you might be asking, how many times do we run these commands?
Well, ideally, once you create your database and it lives somewhere on a computer, somewhere in the
world.
You only run this once, right, you create a table of why you want your database to look like and the
rest is just filling in and inserting information and reading information off of it.
So this is the command that we're going to set up when we create our own database to set up our schemas.
And then after that, it will just run on its own and it will be able to communicate with the back end.
It's going to be very fun, by the way, before we get into the next video and show you one more command.
We learned this lady shows us our tables.
If I do cue, we exit out of here and we're back to the terminal.
All right, I'll see you in the next one.
Bye bye.