All right.
It's time for you to get a little bit of practice with what we've learned in the past few videos.
I'd like you to make a table and insert some values into that table.
According to these instructions, create a table called people.
It should have three columns.
First name is a piece of text or a string.
20 characters or fewer last name, same thing.
And age is a number.
It's I guess we all know age is on the number.
Very funny.
Really, though age is just an integer here.
Once you've done that, I'd like you to insert your first person you can.
You don't have to follow these exact names if you don't want to type them out, but I'd like you to
insert this person, Tina Belcher, who's 13, Bob Belcher is 42, and then do a multiple insert and
get these three all in one go.
And then you can just delete the whole table if you want.
That's what I'm going to do.
So I'm not going to bother making a new database.
I'm just going to do it right here instead of my what is this pet pet shop?
Sure.
We're also selling humans for a pet shop.
So go ahead and try this and pause.
Please pause, because I'm about to go over the solution and I hope you try it on your own first.
So here we go.
We're going to create a people table first name, last name and age.
I guess I'll do this from the shell.
So create table, people.
All right.
And then we want let's do a couple of spaces just to format it fancy.
We'll do first underscore name is a var car var char 20 and then last underscore name is the same thing.
Var car 20 and then age is an int.
I'll close my friends, close the semi or add the semicolon.
That looks good.
Let's double check, describe raffle, describe people and that's good.
First name var car last name var car age int.
Now let's insert this first person.
Tina belcher is 13 so we'll do insert into people and the order is just up to us.
But let's say first name, last name, age and then values.
We'll have Tina.
Voucher.
13.
And let's verify Select star from people looks good.
Tina Belcher 13.
First name, Last name, Age.
All right.
So next up, we've got a second person.
Bob Belcher is 42.
So I'll do it again from the command line.
Of course, you can do these from anywhere that you can run a MySQL query, but I'll do an insert,
honestly.
Well, sure, I'll just retype the whole thing.
But I was going to say, I can just recall this line and I might save myself some time, but it's all
right.
We'll do it insert into.
People first underscore name, last, underscore, name and age values.
And then we have Bob.
Belcher.
42.
Select staff from people, and we see both of them.
Great.
So the last thing we'll do is our multi insert and I think I'll do this one from a file just to make
it easier to type.
So we've got Linda Belcher 45 and I'll speed this up so you don't have to watch me type the whole thing,
but let's type the query select.
Why do I keep saying select insert into people and let's do first name again, last name, age and then
our values.
Now I am going to have to refresh over here in the workbench.
So I see my people table show up.
There it is.
Okay, so we're working with Pet Shop, which has a people table, and the first person we're inserting
is, Is it Linda Belcher?
I think I don't remember her age.
She is supposed to be 45.
Okay.
And then the next person had a comma in there, Phillip Frond, who is 38.
38.
And then we have one more person, which is Calvin.
And I don't know how you spell fish or fish.
C.
H.
O.
E.
D.
E.
R.
Who is 70?
Is that what I said?
All right.
Close enough.
And if I really want it to be particular, I can line these up.
It doesn't matter at all.
Put my semicolon in there.
Execute the query.
And do we know if it worked?
Well, we don't get an error message to get a check mark, which is good.
It says three rows affected.
That's also good.
But I can do a select star from people.
And now we see our three additions that we made in one go with one insert.
And then the last thing I was going to do, which is not really in the instructions, is drop people,
drop table people.
Goodbye.
And all of our people are gone.
If I try and select Star, nothing happened.
Well, it's not that nothing happened.
We get an error because there are no people or rather there is no people table.
So that's our little exercise.
Next up, we've got more to learn.
Obviously, a lot left.