So to close out this section here we're going to get a little practice with data types and the syntax
we're creating and deleting tables.
So one more activity this time I'd like you to imagine that you work at a pastry shop so you're going
to manage I manage in air quotes that you can't see me doing right now but you're going to manage a
pastry shop in the inventory for these pastries.
It's going to be very simplistic but you'll need to create a pastries table and there should be at least
two columns if you want to add more that's fine.
But a name for the pastry.
So what is it a croissant.
A chocolate donut.
Whatever it is as well as a quantity which should be a number so I could go in and see that there are
10 croissants or five chocolate her size and so on.
But we won't fill it with data because we haven't seen her do that.
So we're just defining the table and the columns.
So I'd like you to do that then use a command to inspect your table and the columns using the my.
Well command line interface so one of those short little commands we saw just to make sure basically
to check your work.
And then lastly delete all that hard work to your table so passive idio if you'd like go through this
and come back when you're done and hope.
Be here.
OK.
So I'm back in cloud nine.
I'm actually still if I select database.
I'm still using cat app.
There are no tables in it right now because I deleted the cat's table but I'm just going to put our
pastries table in here even though it has nothing to do with cat app.
Maybe it's a cat bakery or something.
Actually dog bakery so maybe we're not too far off.
But anyways it's just a silly exercise.
So we want to create a table so create table and then the name of the table will be pastries plural.
Then in parentheses and I'm going to do it on one line just to show you that it's not a problem.
So we'll have the name of the pastry.
And one thing that you may be tempted to do if you come from some other databases is to put a code in
there.
That's the thing I find myself doing just some from experience that I have some other tools but you
don't want that there.
So if you see me doing that I hope they catch yourself to create table pastries name is going to be
a Vardar and it should be 50 characters maximum.
So in print this is 50 and then we have age.
Excuse me we have quantity if you want to abbreviate that with just Q T Y which is what you'll see pretty
commonly.
You could do that as well.
And that's just an integer that you need.
I semi-colon to end and we hit enter.
And we have a nice small error message.
So that was accidental.
I'm not going to try and play it off like you did on purpose but I am going to leave it in here.
And that's mainly because it's something that pops up pretty commonly.
People aren't perfect at least I'm not especially when I'm recording.
Got a lot of stuff to worry about.
Can you identify what went wrong.
I'll give you a hint.
I'm just missing one character.
Yep if you've got it I'm missing a comma here and the error messages aren't always that useful but it
tells me there's an error in my syntax and it's something near quantity and so right before that I'm
missing a comma.
It's treating all of this as name which is wrong.
We need that comma there so we can recall that line go back and insert a comma.
Now when we do it we get queery OK and we'll move on to the next part which was to make sure things
worked.
So we could either do show tables and then we can do show let's do describe describe pastries perfect
name for our char quantity is an end and the last thing was to drop our pastries table drop table pastries
goodbye pastries and just to verify it worked.
Let's do show tables again.
And there's nothing here.
Perfect.
So the next section is all going to be about inserting data.
We make tables.
They're empty.
How do we get stuff in there.