WEBVTT

00:00.090 --> 00:05.000
So to close out this section here we're going to get a little practice with data types and the syntax

00:05.000 --> 00:07.110
we're creating and deleting tables.

00:07.140 --> 00:13.950
So one more activity this time I'd like you to imagine that you work at a pastry shop so you're going

00:13.950 --> 00:19.650
to manage I manage in air quotes that you can't see me doing right now but you're going to manage a

00:19.650 --> 00:22.680
pastry shop in the inventory for these pastries.

00:22.680 --> 00:28.260
It's going to be very simplistic but you'll need to create a pastries table and there should be at least

00:28.260 --> 00:30.630
two columns if you want to add more that's fine.

00:30.810 --> 00:32.620
But a name for the pastry.

00:32.620 --> 00:34.990
So what is it a croissant.

00:35.280 --> 00:36.990
A chocolate donut.

00:37.230 --> 00:44.370
Whatever it is as well as a quantity which should be a number so I could go in and see that there are

00:44.370 --> 00:47.830
10 croissants or five chocolate her size and so on.

00:48.090 --> 00:51.060
But we won't fill it with data because we haven't seen her do that.

00:51.060 --> 00:53.890
So we're just defining the table and the columns.

00:54.270 --> 01:01.580
So I'd like you to do that then use a command to inspect your table and the columns using the my.

01:01.700 --> 01:06.840
Well command line interface so one of those short little commands we saw just to make sure basically

01:06.840 --> 01:08.460
to check your work.

01:08.460 --> 01:15.300
And then lastly delete all that hard work to your table so passive idio if you'd like go through this

01:15.570 --> 01:18.170
and come back when you're done and hope.

01:18.180 --> 01:19.370
Be here.

01:20.020 --> 01:20.790
OK.

01:21.150 --> 01:23.090
So I'm back in cloud nine.

01:23.100 --> 01:28.160
I'm actually still if I select database.

01:28.230 --> 01:29.870
I'm still using cat app.

01:29.970 --> 01:34.370
There are no tables in it right now because I deleted the cat's table but I'm just going to put our

01:34.380 --> 01:38.100
pastries table in here even though it has nothing to do with cat app.

01:38.190 --> 01:40.160
Maybe it's a cat bakery or something.

01:40.330 --> 01:42.740
Actually dog bakery so maybe we're not too far off.

01:42.760 --> 01:45.710
But anyways it's just a silly exercise.

01:45.780 --> 01:55.200
So we want to create a table so create table and then the name of the table will be pastries plural.

01:55.860 --> 02:01.660
Then in parentheses and I'm going to do it on one line just to show you that it's not a problem.

02:02.070 --> 02:04.590
So we'll have the name of the pastry.

02:05.140 --> 02:11.370
And one thing that you may be tempted to do if you come from some other databases is to put a code in

02:11.370 --> 02:11.900
there.

02:12.210 --> 02:17.760
That's the thing I find myself doing just some from experience that I have some other tools but you

02:17.760 --> 02:18.710
don't want that there.

02:18.900 --> 02:24.720
So if you see me doing that I hope they catch yourself to create table pastries name is going to be

02:24.720 --> 02:30.530
a Vardar and it should be 50 characters maximum.

02:30.530 --> 02:33.950
So in print this is 50 and then we have age.

02:34.080 --> 02:40.890
Excuse me we have quantity if you want to abbreviate that with just Q T Y which is what you'll see pretty

02:41.100 --> 02:41.700
commonly.

02:41.700 --> 02:42.920
You could do that as well.

02:43.110 --> 02:46.150
And that's just an integer that you need.

02:46.350 --> 02:49.240
I semi-colon to end and we hit enter.

02:49.500 --> 02:52.140
And we have a nice small error message.

02:52.140 --> 02:54.210
So that was accidental.

02:54.270 --> 02:58.580
I'm not going to try and play it off like you did on purpose but I am going to leave it in here.

02:59.130 --> 03:03.500
And that's mainly because it's something that pops up pretty commonly.

03:03.600 --> 03:06.890
People aren't perfect at least I'm not especially when I'm recording.

03:06.950 --> 03:09.350
Got a lot of stuff to worry about.

03:09.390 --> 03:12.070
Can you identify what went wrong.

03:13.160 --> 03:13.640
I'll give you a hint.

03:13.640 --> 03:14.970
I'm just missing one character.

03:16.540 --> 03:22.900
Yep if you've got it I'm missing a comma here and the error messages aren't always that useful but it

03:22.900 --> 03:30.910
tells me there's an error in my syntax and it's something near quantity and so right before that I'm

03:30.910 --> 03:32.310
missing a comma.

03:32.700 --> 03:36.750
It's treating all of this as name which is wrong.

03:36.760 --> 03:45.250
We need that comma there so we can recall that line go back and insert a comma.

03:45.480 --> 03:51.240
Now when we do it we get queery OK and we'll move on to the next part which was to make sure things

03:51.240 --> 03:51.760
worked.

03:51.810 --> 04:03.950
So we could either do show tables and then we can do show let's do describe describe pastries perfect

04:04.160 --> 04:13.670
name for our char quantity is an end and the last thing was to drop our pastries table drop table pastries

04:14.330 --> 04:18.290
goodbye pastries and just to verify it worked.

04:18.330 --> 04:20.170
Let's do show tables again.

04:20.310 --> 04:21.520
And there's nothing here.

04:21.870 --> 04:22.700
Perfect.

04:22.710 --> 04:26.350
So the next section is all going to be about inserting data.

04:26.460 --> 04:27.390
We make tables.

04:27.390 --> 04:28.260
They're empty.

04:28.260 --> 04:29.380
How do we get stuff in there.
