1
00:00:00,150 --> 00:00:06,270
So another thing to know about the insert command is that you can use it to bulk insert data so we can

2
00:00:06,270 --> 00:00:12,750
insert ten different users at once or we can eventually, once we get to it, we can update ten different

3
00:00:12,750 --> 00:00:15,240
users at once or delete ten or whatever it is.

4
00:00:15,330 --> 00:00:21,570
But for insert, the way that it works is that rather than just giving one set of values like Charlie,

5
00:00:21,600 --> 00:00:22,440
who is ten.

6
00:00:23,150 --> 00:00:28,280
We just use a comma separated list, so we tack on a comma and then we add another one.

7
00:00:28,280 --> 00:00:31,790
Sadie, who's three and then comma lazy bear, who is one.

8
00:00:32,390 --> 00:00:35,240
A note about the common placement does not matter.

9
00:00:35,870 --> 00:00:36,890
You'll see it.

10
00:00:37,010 --> 00:00:40,670
I think what's more logical is actually to put it here at the end of the line.

11
00:00:40,940 --> 00:00:46,340
But often what you see is here, I think it makes it easier for you to just visually break things up

12
00:00:46,340 --> 00:00:50,780
and to see, here's a new line and here's a new line, but really just a matter of preference.

13
00:00:50,780 --> 00:00:52,790
So don't pay too much attention to that.

14
00:00:53,300 --> 00:00:54,470
Don't pay any attention to that.

15
00:00:54,470 --> 00:01:00,740
Actually, what's important is that we have a list and we can multiple insert all at once, so let's

16
00:01:00,740 --> 00:01:01,250
try it.

17
00:01:02,720 --> 00:01:05,180
So we have our cat's table with Blue and Draco.

18
00:01:05,540 --> 00:01:11,900
We will do an insert into cat and we'll do name followed by age.

19
00:01:12,920 --> 00:01:20,300
Now we have values and our first pair or first set of values will be, Oh, boy.

20
00:01:20,330 --> 00:01:22,390
This is the hardest part of teaching this stuff.

21
00:01:22,400 --> 00:01:26,390
Coming up with the fake data, let's say peanut.

22
00:01:30,230 --> 00:01:31,550
And Peanut is too.

23
00:01:32,730 --> 00:01:34,740
And comma.

24
00:01:35,010 --> 00:01:36,090
You could have put the comma there.

25
00:01:36,090 --> 00:01:36,810
It doesn't matter.

26
00:01:39,710 --> 00:01:42,980
Let's say the next one will be called butter.

27
00:01:44,240 --> 00:01:45,440
Who is four?

28
00:01:46,070 --> 00:01:49,790
Yes, I am looking at a thing of peanut butter in my kitchen right now.

29
00:01:50,840 --> 00:01:52,370
So that's where that comes from.

30
00:01:53,480 --> 00:01:55,910
And lastly, let's do.

31
00:01:56,960 --> 00:01:57,500
Sure.

32
00:01:57,500 --> 00:01:58,310
Jelly.

33
00:01:59,240 --> 00:02:00,560
Who is seven?

34
00:02:00,770 --> 00:02:03,530
Just like that, we need our semicolon to end it.

35
00:02:06,100 --> 00:02:08,080
Now we get something slightly new.

36
00:02:08,110 --> 00:02:10,479
Query OC three rows affected.

37
00:02:10,720 --> 00:02:11,380
Awesome.

38
00:02:11,830 --> 00:02:18,550
So to check our work we can just do select star from cats again and I should be consistent.

39
00:02:18,550 --> 00:02:23,440
It doesn't matter, but I'll capitalize it from now.

40
00:02:23,440 --> 00:02:25,910
We have Blue Draco which were there before.

41
00:02:25,930 --> 00:02:27,760
Peanut butter and jelly.

42
00:02:28,630 --> 00:02:29,770
That turned out nicely.

43
00:02:30,310 --> 00:02:32,740
And we inserted them all with one command.

44
00:02:32,920 --> 00:02:38,290
So later on in the course, when we start working with some more complicated data, what I'll actually

45
00:02:38,290 --> 00:02:45,430
do is give you a file that has an insert statement that will insert, let's say, 20 different items

46
00:02:45,430 --> 00:02:51,460
into a database, 20 rows, and you'll be able to run that one line and get kind of starter data that

47
00:02:51,460 --> 00:02:52,730
you can use it.

48
00:02:52,750 --> 00:02:57,640
It'll be an easy way to populate your database with data without having to do it manually 20 times.

49
00:02:57,790 --> 00:02:58,060
Okay.

50
00:02:58,180 --> 00:03:00,460
So that's all there is to multiple inserts.

