text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
because F-A could match much more than this painting name.
4,841.1
3
Here, if we have only one painting that begins with imaginative,
4,844.1
4.05
this could work for us now.
4,848.15
2.082
So I'll try this.
4,850.232
0.708
I'll say Enter, and now, let me rerun the query.
4,850.94
4.16
Group by, and we're so close.
4,855.1
2.732
There's still one more.
4,857.832
0.958
"Imagintive Landscape," so for this one, I
4,858.79
3.3
might just need to manually update that piece.
4,862.09
2.88
I could say let's do update, votes, and set title equal to
4,864.97
6.51
in this case "Imaginative Landscape" where, of course, the title currently
4,871.48
4.98
is "Imagintive Landscape" without the A in there.
4,876.46
4.68
Now hit semicolon to run this query.
4,881.14
2.1
I'll show you the results, and now, I think we're literally almost there.
4,883.24
4.56
There's only one more to do.
4,887.8
1.35
Profusion of Flowers.
4,889.15
1.38
Let's fix that one now.
4,890.53
1.56
I could say select votes--
4,892.09
2.79
not select.
4,894.88
0.84
Update.
4,895.72
0.57
I'm always updating here.
4,896.29
1.042
Update votes, and then we want to set the title
4,897.332
4.178
column to be equal to profusion--
4,901.51
3.6
"Profusion of Flowers" like this.
4,905.11
4.05
Then where the title is like, in this case, profusion at the beginning.
4,909.16
6.72
Notice how I can't use perfusion space and then
4,915.88
3.45
afterwards because we have one title that is literally just "Profusion,"
4,919.33
4.86
plain and simple.
4,924.19
0.84
No spaces afterwards.
4,925.03
1.065
No spaces at the beginning.
4,926.095
1.125
To match that, I should just say profusion at the beginning.
4,927.22
3.64
Now I can hit Enter, and if I do my usual query
4,930.86
3.8
to show you the votes grouped by title, I
4,934.66
2.61
see I'm finally at my correct, fully-formatted data set.
4,937.27
4.53
Farmers Working At Dawn has six votes.
4,941.8
2.43
Imaginative Landscape has five, and so on down the row.
4,944.23
4.23
So here we've seen update being used not just to associate artists
4,948.46
4.62
with new paintings, but also to clean our data,
4,953.08
3.06
to make sure we can actually tally votes up in a way that's
4,956.14
2.97
consistent and clean in this case.
4,959.11
3.64
What questions do we have on update now?
4,962.75
2.67
Let's go to [? Vixay. ?]
4,968.38
1.82
[? VIXAY: ?] Yeah, so what I wanted to ask
4,970.2
1.75
is if there is a specific function for like lowercase.
4,971.95
3.48
So there's a function for upper, and these are the ones for all lowercase.
4,975.43
4.607
SPEAKER: Yeah, a good corresponding question here.
4,980.037
2.083
We used upper, but is there lower?
4,982.12
1.86
Turns out, there is a lower function.
4,983.98
1.62
It's spelled lower, and is in all lowercase like upper was,
4,985.6
4.08
so I could use that as well.
4,989.68
1.89
There is a whole list of what SQLite calls these scalar functions, functions
4,991.57
4.38
that take in some set of values and return to you some modified
4,995.95
3.99
version of those values.
4,999.94
1.54
So if you do some googling, look for SQLite scalar functions.
5,001.48
2.69
You can find all those functions in one place in the SQLite documentation.
5,004.17
6.25
Let's take one more question here.
5,010.42
1.78
Let's go to Rupinder.
5,012.2
1.42
RUPINDER: So, yeah, my question is so instead of updating all the titles,
5,013.62
4.77
is it possible to create a new column with the four categories
5,018.39
3.93
that we want to have actually?
5,022.32
3.035
SPEAKER: Yeah, I could see that working, too.
5,025.355
1.875
So there's a few ways to fix this data.
5,027.23
1.625
You could imagine adding a new column, and maybe you
5,028.855
4.205
assign values to the rows in that column based on what you see in the title
5,033.06
6.482
that they've given you.
5,039.542
0.958
So if you can match something like imaginative,
5,040.5
2.76
and you'd know that all your paintings associated with imaginative
5,043.26
3.24
have the same title, you could group them into the one category, the two
5,046.5
3.84
category, and so on.
5,050.34
1.77
Here, you wouldn't be modifying those titles.
5,052.11
2.16
You'd just be trying to strategically apply
5,054.27
2.7
different categories, which could also work as a solution here,
5,056.97
2.64
too, so good thinking.
5,059.61
2.82
OK, so we've seen now how to insert data, how to update data,
5,062.43
5.31
and previously, how to delete data.
5,067.74
2.51
What we can still do though, are learn how to have other SQL command--
5,070.25
5.65
other SQL statements that can run after we make our very own SQL
5,075.9
3.918
statements as well.
5,079.818
0.792
We'll come back and talk about these things called triggers.
5,080.61
3.54
And we're back.
5,084.15
1.69
So we've seen now a whole collection of ways to write data to a database.
5,085.84
4.79
We've seen how to insert data, how to update data, and even delete data.
5,090.63
5.45
What we'll see now though, this idea of a trigger,
5,096.08
2.92
a way of writing a SQL statement to run in response to some other SQL statement
5,099
5.67
like an insert, an update, or a delete.
5,104.67
4.11
Let's consider our museum yet again, and let's say they
5,108.78
4.11
have a schema a bit like this one now.
5,112.89
2.97
They have items in their collections, but they also
5,115.86
3.06
have a transactions table.
5,118.92
2.37
Now wouldn't it be nice if whenever I deleted something from the collections
5,121.29
5.1
table, it would show up in transactions as sold, having been
5,126.39
4.8
sold from the museum's collections.
5,131.19
1.93
Well, I could use a trigger to do just that.
5,133.12
3
Let's see it visually first though.
5,136.12
2.15
I'll say, let's try to delete "Spring Outing" from our collections table.
5,138.27
4.89
Well, if I do that, I could pretty easily do it with delete from, right?
5,143.16
4.14
Now it's no longer part of my database, but if I
5,147.3
3.24
have created a trigger to run an insert whenever I hear
5,150.54
5.22
or have listened to a delete on my collections table,
5,155.76
3.45
I could then see that same title in my transactions table
5,159.21
5.16