Data in a relational database is stored in tables.
Each table stirs data about a specific topic.
For example users products or articles the table is made up of rolls and columns just like a spreadsheet.
Each row of the table contains all the information about an individual item.
For example a single user product or article.
Roles are commonly referred to as records.
Each row is divided into columns.
Each column represents a particular piece of information about that item.
For example a user's name a product price or an article or publication date.
These are commonly referred to as fields.
Each field is defined to hold a specific type of data.
For example no text or a date.
There is a full list of the possible data types here although in practice you'll probably only ever
need a few of them.
For example nos strings and dates.
In addition to the fields that describe each rijkaard we need a way to uniquely identify each rijkaard
so that we can later select it.
Update it.
I'll delete it although this could be one of the existing columns.
If it contains something unique.
For example an e-mail address.
It's more common to have a specific Hi D column.
This is usually a simple integer starting at 1 and increasing by one for each new record.
Using this we can uniquely identify every row in the table will also use this later on when we start
to relate one table to another which is where the relational part of a relational database comes in.
The unique idea column is known as a primary key.
Let's go ahead and add a table to our database.
First we need to enter a name.
You can call the table whatever you like.
The convention is to use a singular noun to describe the tables contents for example user product or
article.
If you have more than one word separate the words with an underscore instead of a space for example
customer invoice and it's best practice to use lower case letters with no accented characters.
So let's create a table to store articles.
Then we need to enter the number of columns.
I'll accept the default of 4.
You can always add remove columns later if you need to.
Will click go.
And we then have to define the tables columns first.
Each column has to have a name.
Again this should be lower case using underscores if you need to separate words with no axe and characters.
Let's start with a primary key column which we'll call it.
Then we choose the type.
And here we have a list of all the possible types.
If you hover over a type it tells you more about it.
The idea field is going to be an integer next as this is the primary key in the index column.
We need to specify primary.
Will learn more about indexes later on.
Finally far this field I am going to check the arto increment box.
This will let us insert Ricardos without having to specify a value for this field.
It'll be inserted automatically based on the existing values.
In other regards we'll see an example of this in a moment.
Next each article is going to have a title.
So let's enter the title field.
This is going to be a string.
We have various options for this.
Chas varchar text and so on.
The best one to use for the title is varchar as it's going to be a relatively short string.
And we don't want it padded with spaces which is what the char type would do.
This also requires us to specify a length.
So I'll put 128 characters.
If we find that we need to store titles longer than this we can always adjust this later.
Next our articles are going to have content.
Which is going to be a string.
But this time it could be very long.
So will specify it as text.
Finally Each article will have a date and time that it was published which will call published at.
It's a common convention to give dates and time values in name in this format.
This is going to be a date and time for which we have the date time type.
Also on this field we're going to check the null check box.
This means that this column can also be null.
In other words not contain a value for other columns where this isn't checked.
If you tried to insert a record with out a value in these fields you'd get an error checking this box
here means that this field can be left empty.
If you want.
This would be for articles that haven't been published yet for example.
And that's it to create the table.
We go down and click save.
And there it is.
Now we can add some data to it.
If we click on insert appear we're shown a farm where we can insert a couple of rows with fields for
each of the columns.
First is the idees column which we created as an integer.
So the first rijkaard would be a 1.
However when we created this field we checked the of increment box so this field will be filled in after
magically So we don't need to.
This is very common for numeric primary keys.
It's much safer to let the database deal with assigning unique number to new records.
Next we need a title which we'll put here and then some content.
And further published at field will select a date and time with this button.
Underneath will add another record with a value for the title.
And some content.
And we'll select a date and time.
And then at the bottom we'll click go and those records are inserted.
You can insert as many records as you like but here if we click browse there we can see the data in
our table.
And as you can see the field has been supplied after magically.