text
stringlengths 1
81
| start
float64 0
10.1k
| duration
float64 0
24.9
|
|---|---|---|
I should see in this case
that insert didn't work.
| 1,011.4
| 6.01
|
So these constraints are
really guardrails against me,
| 1,017.41
| 3.11
|
against other users to
adding values that we really
| 1,020.52
| 2.46
|
shouldn't add to our table.
| 1,022.98
| 3.5
|
OK, so presumably here, we're onto
something by adding some rows.
| 1,026.48
| 5.92
|
But if the museum acquires more
than one item, maybe 100 at a time,
| 1,032.4
| 5.33
|
I don't want to be the programmer who's
sitting there writing 100 INSERT INTO.
| 1,037.73
| 3.389
|
That's like not what I want to do.
| 1,041.119
| 1.621
|
There's probably a
better way to do this.
| 1,042.74
| 1.89
|
[? And ?] [? we ?] show
you one way to do this.
| 1,044.63
| 2.41
|
One way is to instead of inserting
one row, like this, to instead insert
| 1,047.04
| 5.15
|
multiple separated by commas.
| 1,052.19
| 2.71
|
So here, I might say this is my
first row for each of these columns.
| 1,054.9
| 4.97
|
This is my second row, again,
for each of these columns,
| 1,059.87
| 3.21
|
and so on and so forth.
| 1,063.08
| 2.29
|
And it's worth noting, this is
not just a manner of convenience.
| 1,065.37
| 4.16
|
Like if I tried to insert 100 rows,
this is certainly convenient for me.
| 1,069.53
| 4.6
|
But it's also most often
in most cases going
| 1,074.13
| 3.08
|
to be faster for me to
insert 100 rows in one go,
| 1,077.21
| 3.99
|
than to insert one row 100 times.
| 1,081.2
| 3.19
|
So this is both a convenience
thing for programmers
| 1,084.39
| 2.54
|
and also an efficiency thing to
actually optimize your database as well.
| 1,086.93
| 4.81
|
So let's try this syntax now to avoid
me sitting there for hours and hours
| 1,091.74
| 4.61
|
writing many insert interviews.
| 1,096.35
| 1.89
|
I'll go back to my computer.
| 1,098.24
| 2.22
|
And this time, let's say we
got two paintings at once.
| 1,100.46
| 3.48
|
We got two.
| 1,103.94
| 0.81
|
So I'll try to add both of them.
| 1,104.75
| 1.92
|
I'll say INSERT INTO
the "collections" table.
| 1,106.67
| 3.84
|
And again, I want to keep adding to my
"title" column, my "accession_number"
| 1,110.51
| 5.22
|
column, and even my
"acquired" column, like this.
| 1,115.73
| 4.47
|
Now, I want to add in some values.
| 1,120.2
| 2.44
|
So I'll type VALUES here.
| 1,122.64
| 1.73
|
And as a matter of style, let me
just say I'll make a new line.
| 1,124.37
| 4.02
|
I'll Enter here.
| 1,128.39
| 1.26
|
And now I can type each of my
new rows on their very own line.
| 1,129.65
| 4.71
|
So again, I'll type all of the
values that I want in my first row.
| 1,134.36
| 4.86
|
I might call this one
"Imaginative landscape."
| 1,139.22
| 3
|
We got this one back in--
| 1,142.22
| 1.565
|
actually, we don't quite
know when we got this one.
| 1,143.785
| 2.125
|
If I type 56.496 is the accession
number, like, yeah, 56.496.
| 1,145.91
| 6.3
|
The MFA actually doesn't know
when they got this painting.
| 1,152.21
| 3.22
|
So if they don't know,
let's just insert NULL.
| 1,155.43
| 3.38
|
This is intentionally left blank.
| 1,158.81
| 3.99
|
This is my first row.
| 1,162.8
| 1.35
|
Now, I want to add a
second one in one go.
| 1,164.15
| 2.82
|
I'll follow this up with a comma.
| 1,166.97
| 1.72
|
And now, I'll type out
my next set of values.
| 1,168.69
| 3.56
|
This next one we acquired is
called "Peonies and butterfly."
| 1,172.25
| 3.75
|
Now, I'll say the [? accession ?]
[? number ?] is 06.1899.
| 1,176
| 4.71
|
And we got this one-- it was back in
1906-01-01 now I'll hit semicolon here.
| 1,180.71
| 7.86
|
And now, if I hit
Enter, nothing happens.
| 1,188.57
| 3.73
|
But if I type Select [? star ?]
FROM "collections" semicolon,
| 1,192.3
| 5.03
|
what do we see, but now two
new rows being inserted.
| 1,197.33
| 4.63
|
So a handy way to insert
more than one value.
| 1,201.96
| 3.54
|
And also, if you have a lot of
values, a more efficient way as well.
| 1,205.5
| 5.01
|
So we pause here.
| 1,210.51
| 1.52
|
And ask what questions we have on
INSERT INTO, Whether adding one row
| 1,212.03
| 5.9
|
or adding multiple.
| 1,217.93
| 1.62
|
Let's go to [INAUDIBLE].
| 1,219.55
| 1.77
|
SPEAKER 4: [? So ?] [? imagine ?]
you are [? writing ?] [? code ?]
| 1,221.32
| 2.75
|
or inserting a row, so by mistake
you have entered the wrong spelling
| 1,224.07
| 4.63
|
of the title, so how we will rename it?
| 1,228.7
| 3.017
|
SPEAKER 1: A great question too.
| 1,231.717
| 1.333
|
And often as is the case with
me, I make typos all the time.
| 1,233.05
| 2.85
|
I might add the artwork title
and misspell it for instance.
| 1,235.9
| 4.14
|
Well, in that case, I can't
use INSERT INTO to correct it,
| 1,240.04
| 4.56
|
but I can use a new statement we'll
see a little later called [? update. ?]
| 1,244.6
| 3.81
|
And so with [? update, ?]
you can actually
| 1,248.41
| 1.8
|
change the spellings of things.
| 1,250.21
| 1.62
|
And we'll see that a little later today.
| 1,251.83
| 2.1
|
But great question to
peek ahead as well.
| 1,253.93
| 3.84
|
OK, so let's keep going here.
| 1,257.77
| 2.5
|
Let's think about how we can keep
adding values to our data set.
| 1,260.27
| 4.23
|
And so far we've seen INSERT INTO
with one row and with multiple.
| 1,264.5
| 5.12
|
But one more way to keep in
mind is you might already
| 1,269.62
| 4.02
|
have your data, perhaps
in some other format.
| 1,273.64
| 3.66
|
And one common format looks a bit
like this on our screen over here.
| 1,277.3
| 5.64
|
This file is called CSV
for Comma Separated Values.
| 1,282.94
| 6.81
|
Now, why Comma Separated Values?
| 1,289.75
| 2.01
|
Well, let's just look at it.
| 1,291.76
| 1.59
|
Here we see some presumably
column or column names,
| 1,293.35
| 3.36
|
like [? id, ?] [? title, ?]
[? accession number, ?]
| 1,296.71
| 2.82
|
and [? acquired, ?] but what
separates these column names?
| 1,299.53
| 3.45
|
Well, it looks like commas--
| 1,302.98
| 1.53
|
"id" comma "title," comma
"accession_number," and so on.
| 1,304.51
| 3.96
|
Every row is still its own row.
| 1,308.47
| 2.88
|
That makes sense here.
| 1,311.35
| 1.32
|
But now, those row values
are also separated by commas.
| 1,312.67
| 4.74
|
Notice here, the first
value before the first comma
| 1,317.41
| 3.69
|
corresponds to the first
column, this id is 1.
| 1,321.1
| 4.11
|
Similarly, the next Comma Separated
Value Profusion of flowers
| 1,325.21
| 3.84
|
belongs to that next column
here-- "title" as well,
| 1,329.05
| 3.4
|
and so on and so forth.
| 1,332.45
| 1.62
|
You could if you wanted
to draw a snaky line
| 1,334.07
| 2.75
|
to see how these columns
correspond down our file here.
| 1,336.82
| 4.96
|
Now, you might often have
data already in this format.
| 1,341.78
| 3.94
|
And it's actually
pretty convenient to try
| 1,345.72
| 1.75
|
to import this data into
SQLite into your very own table
| 1,347.47
| 4.29
|
so you can use [? SQL ?] on it.
| 1,351.76
| 2.41
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.