WEBVTT

00:00.240 --> 00:06.210
So another thing to know about the insert command is that you can use it to bulk insert data so we can

00:06.210 --> 00:12.720
insert 10 different users at once or we can eventually once we get to it we can update 10 different

00:12.720 --> 00:15.290
users at once or delete 10 or whatever it is.

00:15.360 --> 00:21.570
But for insert the way that it works is that rather than just giving one set of values like Charlie

00:21.600 --> 00:23.100
who is 10.

00:23.270 --> 00:29.330
We just use a comma separated list so we tack on a comma and then we add another one Saidy who's three

00:29.450 --> 00:35.790
and then comma lazy bear who is one note about the column placement does not matter.

00:35.960 --> 00:36.820
You'll see it.

00:37.040 --> 00:41.010
I think what's more logical is actually to put it here at the end of the line.

00:41.030 --> 00:46.550
But often what you see is here I think it makes it easier for you to just visually break things up and

00:46.550 --> 00:50.800
to see hey here's a new line and here's your line but really just a matter of preference.

00:50.900 --> 00:53.230
So don't pay too much attention to that.

00:53.390 --> 00:55.280
Don't pay any attention to that actually.

00:55.460 --> 01:00.400
What's important is that we have a list and we can multiple insert all at once.

01:00.410 --> 01:02.630
So let's try it.

01:02.870 --> 01:10.940
So we have our catch table with blue and Draco we will do an insert into cats and we'll do name followed

01:10.940 --> 01:19.360
by age now we have values and our first pair are first set of values will be.

01:19.540 --> 01:24.490
Oh boy this is the hardest part of teaching this stuff coming up with the fake data.

01:24.590 --> 01:26.140
Let's say peanut

01:30.320 --> 01:35.900
and peanut to and comma could they come.

01:35.900 --> 01:36.860
There doesn't matter.

01:39.680 --> 01:44.260
Let's say the next one will be called butter.

01:44.330 --> 01:45.640
Who is four.

01:46.160 --> 01:50.820
Yes I am looking at a thing of peanut butter in my kitchen right now.

01:50.900 --> 01:52.870
So that's where that comes from.

01:53.570 --> 01:56.960
And lastly let's do.

01:56.990 --> 01:57.560
Sure.

01:57.560 --> 01:59.230
Jelly.

01:59.240 --> 02:00.740
Who is it.

02:00.920 --> 02:01.670
Just like that.

02:01.760 --> 02:03.680
We need our semi-colon to end it.

02:06.190 --> 02:08.170
Now we get something slightly new.

02:08.180 --> 02:08.990
Cleary OK.

02:09.040 --> 02:10.770
Three rows affected.

02:10.780 --> 02:11.550
Awesome.

02:11.980 --> 02:18.540
So to check our work we can just to select a star from cats again and I should be consistent.

02:18.550 --> 02:19.170
It doesn't matter.

02:19.180 --> 02:21.680
But I'll capitalize.

02:21.680 --> 02:30.560
From now we have blue Draco which were there before peanut butter and jelly that turned out nicely and

02:30.560 --> 02:32.760
we inserted them all with one command.

02:33.050 --> 02:38.450
So later on in the course when we start working with some more complicated data what I'll actually do

02:38.450 --> 02:45.680
is give you a file that has an insert statement that will insert let's say 20 different items into a

02:45.680 --> 02:52.500
database 20 rows and you'll be able to run that one line and get kind of starter data that you can use.

02:52.640 --> 02:57.640
It will be an easy way to populate your database with data without having to do it manually 20 times.

02:57.850 --> 02:58.190
OK.

02:58.220 --> 03:00.330
So that's all there is to multiple answers.
