So, time to add some data.
And for this, I'll first of all,
start by adding an address and the type,
so that thereafter,
I can add a restaurant
that is linked to that address and that type.
For this, let's maybe start with types.
And, to insert some new data here,
I'll add a new SQL statement.
And then, we learned that we can insert value
with the INSERT INTO statement.
And, I wanna insert data into my types table here.
And then thereafter, between parentheses,
we list all the columns into which you wanna add data.
In my case,
the types table does have two columns,
ID and name.
And, I wanna add a value for the name column,
because the ID will be auto-incremented automatically.
And hence, after the values keyword as you learned,
you now define the concrete values
that will be inserted for the columns you specify here,
so for the name column, in my case.
And that here
could be Italian,
so that we have Italian cuisine as one restaurant type.
We now execute this.
That did
work.
Now, let me clear this.
And, let's also maybe add
American,
and also
German,
and maybe also Austrian.
Now, it's up to you which cuisines you wanna add.
Now, I did add four cuisines.
And therefore to see them,
We can run SELECT + * to select everything,
all the columns,
FROM
types.
And if we execute this here, we see our data.
So, that is working.
Now, it's time to add some addresses.
Now for this, we have the addresses table,
which has these columns.
You'll see here on the left.
And hence now, our SQL statement is INSERT INTO, addresses.
Then, we list the columns into which we wanna insert data.
We don't need to insert anything into ID,
because that's set automatically.
But, I wanna set the value for the street.
Then, separated by a comma,
the next column will be street_number,
then the city,
then the postal code,
and then the country.
So, bunch of columns which I want to populate,
and now we can specify the values.
By the way,
you can also split this across multiple lines
to make this easier to read now.
Here between these parentheses,
we can add a line break
and then add our values here.
So now for the street,
I could work with the Teststreet,
separated by a comma.
The number is a string, is a varchar,
because that's how we defined this field to work.
So, that could be 23a
to also show you why it is a varchar.
Then here for the city,
that could be Munich,
or whatever you want.
Then the postal code, in my case here, is an integer.
So here, that could be this integer value,
no quotes around it, because it is an integer.
And then the country, in this case, is Germany.
And now, if I execute this, that was added.
Now, I'll add a second value here real quick.
So, the
Great
street,
let's say,
12,
in Berlin.
And then here, I got a postal code.
Let's say it's 1
0115,
and it's all the Germany.
And of course, you can add other countries as well.
You can add whichever kind of data you want.
Confirm this.
And now, let's also see whether that data is there
by selecting all the columns from addresses,
and no where constraints,
so we also select all the rows,
and therefore, here's the data I got.
So, that data was stored correctly.
And therefore now, we can start storing a restaurant.
Here, we got these columns which we need to populate.
So again, let's insert a value,
into,
restaurants,
and define the columns which we wanna set.
And here, we don't need to set the ID as always,
but I do want to set the name,
and of course,
also the address_id
to make it clear to which address this restaurant belongs,
so which address it has,
and the type_id.
So, we add these columns as well.
Then, we define the values after the values keyword,
and for the name,
that could be,
the
"Schnitzelhaus",
and the address should be the address in Munich.
And of course, that has an ID of one.
You see it here.
So, I specify one as a value for address_id here.
That's my unique ID that I have here.
And I have to pick this ID,
which my Munich address here has,
in the addresses table,
to link this restaurant,
which I'm about to add,
to this specific first address here.
Now, for the type,
I wanna have German as a type.
And here, I'll quickly add a new SQL statement
where I select
all types again,
so that we can see all the entries here.
And we see that German here has an ID of three.
Therefore, where I insert this,
the value for the type ID should be three here,
separated by a comma.
And therefore, we still add values like before.
There isn't really anything special about it.
But of course, the values I pick for address_id and type_id
are now the concrete IDs I picked from the other tables.
So now, we can run this query,
and that was inserted.
And, if we now add a second restaurant,
let's say the "Burgerhouse",
yeah, I'm super creative when it comes to these names.
And, let's say that's also in Munich.
So I'll keep one here,
but the type now is American.
So, I choose two here as a value,
and,
execute this.
And then, I'll add a third restaurant,
and that that should be,
let's say, some Italian cuisine.
So ID one,
in Berlin,
which has an ID of two.
So, I changed this to two,
and I'll name it "La Mama".
Then, we can run this to also at this restaurant.
And if we now, again,
select everything from restaurants
to have a look at all the stored data,
then this is what we see.
So, that was all stored.
Now, before we learn how we can now query related data,
let's also add a first review already.
And, maybe try adding one on your own
with some arbitrary data,
that's up to you,
with a rating between one and five.
In the next lecture, we'll do it together.