Hello and welcome.
In this ft you.
We will use the rescue will create command to create a table before we create the table.
There are a few guidelines that we need to be aware of table names must begin with a letter and they
must have a character between one and 30 characters long so the character limit should be between one
and 30.
Long table names can contain a tizzy.
Anything from eight to see either of part or lower case.
They can also contain numbers 0 9 they can contain a negative sign that can contain a dollar sign and
pound sign or hash tag sign table names can not be duplicate names.
For example you can't name a table with a name that already exist within the same schema.
For example I think we are working on the here Charles scheme which comes with the Oracle database.
We can't have duplicate names within that schema.
So there is a table quote employees.
I can't go ahead and create another table quote employees within the same scheme.
We cannot use a reserve name or reserve word to create a table.
For example we can't use the word select or from or way those are reserved key words that me obscure
language he uses so we can't use them to create tables.
I have got to add for a court editor opened.
I am going to create a table and am going to give the table name destination.
I am also going to create a quasi trained constraint within the table.
What the constraint will do is that it will enforce some kind of rule on that table so to create a table
you start with the table so to create a table you type in bickie would create
space and then type in table.
Then typing.
If you are not in the same schema as the table you are trying to create.
You need to specify it was schema.
You are creating the table in.
So I was specify here char even do i mean hey char schema is good practice so you get the hang of it
and then after B scheme you specify dot and then you type in the table name.
So I'm creating a table of destination half defining D table name.
Next line you need to place to Para.
Pieces left and right and then in-between is where you will insert B values for this table.
So I do this as separate.
And then in between you come there and specify the columns.
So the first column I wanted to be a destination.
A D.
Then I need to give it the data type.
What type of data is it going to be.
Is going to be in number.
So our number will be the data type and the value will be 6.
While it's six main things that the names are decimal places so you can have numbers up to the value
of six decimal places so that the first column second column I am going to call ctd
and then the data type will be varchar var child to varchar to is the data type.
So when specifying columns you need to specify what type of data that's going to go in there.
This is going to be a varchar to and then going to give it a value of 25 bytes
and then I'm going to give one a set the constraint in that column so that the column is not novel.
That means a data more something of value must be put in to that column.
When creating importing values so you do a constraint within them constraint
followed by ID in name of the constraint.
It's good to name your constraint that relevant to the column so you know.
Makes it easy for you to identify.
So I'll go see to
underscore.
Name.
And then you set the value the value is not
not a lot lower means it means it can not be empty of value must be put in there.
Okay so the neg's column always separate your values with a comma when creating tables have after of
first column.
You put a comma second one comma.
Then the file or column pull is table.
It's going to be called country.
And I want this to be a varchar of two data type.
I'm giving it 45 bytes.
Finnicky noted the last column doesn't need a comma because I'm done.
And then you end with the same I call on very important.
So the script is being written to create a table.
So all I need to do is execute and the table will be inserted into the database.
So these are the columns for the table.
They are enclosed inside parenthesis left and right is very important.
You see that they match up.
That's why the green is highlighted and then end your statement with a semicolon.
Very important.
So you use the create table keyword to create a table.
Specifies this schema where the table is going to be created.
These are not really necessary because I am already in the schema.
Not see it there.
I mean the H R scheme.
But is good practice to specify that an I'm giving.
The giving it the table three columns first one destination underscore eidy we to date a type of number
and he can take up to six values six digits in the second column here city with a voucher to take 25
bytes a set of constraint within named city underscore name and value not not means.
This is collomb here can cannot be empty.
You must put something in there and then finally a goal column called Country bar chart two point five
bytes are less common.
This data you could execute 3 that says table created table created.
So we have successfully created a table so to check that out to a select on the table select
are from.
Destination.
So what this would do it would bring all the record from that table.
It should be empty at the moment.
Excellent.
We've got three.
Three o'clock.
Destination city country derived from.
So we have successfully created it in this video.
We created a table brandnew table in the h.r. schema.
We give you a table three columns and we set to datatypes for the columns.
And we successfully committed.
When you create a table or you create anything on the database once you've executed it.
You must also commit.
This is a comet botin is very important.
We don't comment.
It's not permanent so click it.
So once you've committed you can't roll back but when you don't come it is easy to roll back to what
you've done so because I've now committed the data table to the database it's now permanent.
So if you're not sure you want something to be permanent don't commit it for boys good practice to always
complete your work was you sure you wanted it to go in.
So now comito that the table now is permanent or less is deleted.
So thank you so much for watching.
I hope the video has been useful in helping you to learn how to create a table using the excuse.
Create command.
Thank you and bye for now.