text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
In this case, I'll use the let's say [? collections' ?] [? name, ?] DELETE
2,355.27
5.13
FROM "collections."
2,360.4
1.92
But I don't want to do this.
2,362.32
1.3
I don't want to say DELETE FROM "collections"
2,363.62
1.97
semicolon end of statement, because then I'll delete every row.
2,365.59
5.19
What I should instead do is this.
2,370.78
2.76
DELETE FROM "collections" WHERE some condition is true.
2,373.54
4.05
Maybe the title in this case is a title I'm trying to remove.
2,377.59
3.78
So I'll say "title" equals "Spring outing," just like this, semicolon,
2,381.37
6.06
Enter.
2,387.43
1.08
Now, nothing seems to happen.
2,388.51
1.23
But if I do SELECT [? star ?] FROM "collections" semicolon,
2,389.74
5.4
we no longer see Spring outing.
2,395.14
2.28
And notice here, how the id column, the id of 3 is now gone.
2,397.42
5.16
If I were to insert some new row here, I would start over
2,402.58
3.3
with the highest number, which is 7 in this case, going from 7 to 8.
2,405.88
4.23
But 3 is no longer part of our database.
2,410.11
4.04
Let me try this again, notice how this one called Imaginative Landscape,
2,414.15
4.02
the acquired date is NULL.
2,418.17
1.77
We don't know when we got it.
2,419.94
1.873
Well, let's say that we eventually sell.
2,421.813
1.667
It's no longer part of our database.
2,423.48
1.53
We could use a condition based on NULL to remove this particular artwork.
2,425.01
4.8
So I'll say this.
2,429.81
1
Let me try to DELETE FROM "collections" WHERE "title" equals--
2,430.81
5.96
not Spring outing, but WHERE the acquired date-- sorry,
2,436.77
3.15
the "acquired" date IS NULL semicolon.
2,439.92
4.56
I could also use is NOT NULL--
2,444.48
3.01
WHERE "acquired" IS NOT NULL, but that would delete all the pieces of artwork
2,447.49
3.86
that actually have an acquired date.
2,451.35
2.16
Here, I want to leave only those that do not have an acquired date.
2,453.51
3.75
So I'll say where "acquired" IS NULL.
2,457.26
3.51
Now, I'll hit Enter, nothing seems to happen,
2,460.77
2.55
but I'll say Select [? star ?] FROM "collections" semicolon.
2,463.32
4.53
And I'll see that piece of artwork is now gone.
2,467.85
4.17
I only have those that have an acquired date.
2,472.02
4.8
OK, so similar to [? INSERT, ?] we've been able to [? delete ?] one row
2,476.82
6.06
at a time.
2,482.88
1.11
But it would probably be helpful for us to delete multiple rows at a time
2,483.99
4.38
as well.
2,488.37
1.18
Let's look again at our table.
2,489.55
1.91
Here we have our artwork, as it currently stands, and maybe
2,491.46
4.74
let's say we want to delete those pieces that we acquired before 1909.
2,496.2
5.82
Here in Boston, the MFA actually moved locations in 1909 to a new place
2,502.02
4.95
still in Boston, but a brand new building altogether.
2,506.97
2.8
So let's say that perhaps they left some items at their old location,
2,509.77
3.32
they're no longer part of their collections.
2,513.09
2.67
Via what condition do you think could I select these three rows from
2,515.76
7.16
my [? DELETE ?] [? FROM? ?] What could I put in my condition to delete these
2,522.92
5.75
three rows?
2,528.67
1.23
Let me ask the audience here.
2,529.9
1.77
What might you propose for [? delete ?] [? from ?] here to delete those three
2,531.67
4.11
particular rows?
2,535.78
0.795
Let's go to [? Shiv. ?]
2,541.54
1.11
SPEAKER 9: Greater than [? 5. ?] [? id ?] equals greater than 5.
2,542.65
3.818
SPEAKER 1: That's a good observation.
2,546.468
1.542
So we could look at our table here.
2,548.01
1.458
We see the id could be greater than or equal to 5, that would
2,549.468
4.022
remove these three rows certainly.
2,553.49
2.73
There's probably another way to do this too.
2,556.22
2.16
Any other ideas besides the id, what else can we use?
2,558.38
3.81
Let's go to [? Yasavi. ?]
2,569.86
1.85
SPEAKER 10: So we could compare the dates and use greater than or less
2,571.71
3.36
than sign with the acquired dates.
2,575.07
3.27
SPEAKER 1: So you're proposing to use the date column too.
2,578.34
2.46
That makes sense to me as well.
2,580.8
1.32
We could see acquired here, perhaps we could see,
2,582.12
3.18
is the acquired value less than 1909, that year that we move locations,
2,585.3
5.8
we could also probably use the title, the [? accession ?] [? number, ?]
2,591.1
3.41
and so on.
2,594.51
0.88
And each has their own [? trade-offs. ?]
2,595.39
2.21
Remember, though, for this particular query, which
2,597.6
2.43
is deleting those items that were part of the museum
2,600.03
3.45
acquired before 1909, probably best to use the acquired
2,603.48
5.73
date to actually delete those rows.
2,609.21
3.03
What if, for instance, our ids are actually not like this.
2,612.24
3.69
But they're kind of interspersed around.
2,615.93
2.28
I couldn't really do a query like if the id is greater than or equal to 5,
2,618.21
3.66
because I could also include those that were maybe acquired 1911,
2,621.87
3.24
[? 1956, ?] and so on. [? It's ?] [? probably ?] ideal for me to use this
2,625.11
3.57
date if it's the date that I ultimately care about.
2,628.68
3.46
So let's try this.
2,632.14
1.07
I'll go back to my environment.
2,633.21
2.37
And I'll try to delete these three particular rows.
2,635.58
3.51
I'll try DELETE FROM "collections," as we saw before.
2,639.09
4.66
But now here comes my condition.
2,643.75
1.88
I'll say WHERE the "acquired" column is less than some date that I'll give.
2,645.63
6.6
And here, I'll give 1909-01-01.
2,652.23
4.95
It turns out that SQLite has a few ways to represent dates.
2,657.18
4.08
One of which is this format that follows the YYYY or the year,
2,661.26
5.04
four digits, and then dash, and then MM or the month with two digits,
2,666.3
4.98
and then dash again, DD, in this case, the day in two digits.
2,671.28
4.06
So 1909-01-01 means January 1st, 1909.
2,675.34
7.13
And I can use these same operators with dates.
2,682.47
3.96
I could say greater than, or less than, or equal to this particular date.
2,686.43
4.8
And SQLite will be able to parse this for me to understand what I mean,
2,691.23
3.15
which is earlier than 1909.
2,694.38
3.63
So let's try this then.
2,698.01
1.32
I'll hit Enter, and nothing seems to happen.
2,699.33
3.12
But if I do SELECT [? star ?] FROM "collections,"
2,702.45
3.42