text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
And each line here is one vote for
a [? museum-goers ?] favorite piece | 4,179.649 | 4.38 |
of artwork. | 4,184.029 | 0.721 |
We see "Farmers working at dawn,"
we see "Imaginative landscape," | 4,184.75 | 3.569 |
"Profusion of flowers." | 4,188.319 | 1.471 |
And our goal is to count up these
votes to see which is the most popular. | 4,189.79 | 5.49 |
Well, let's try using .import again to
actually turn this CSV into our very | 4,195.28 | 6.39 |
own SQLite database. | 4,201.67 | 1.86 |
Let me go back to my [? TERMINAL, ?]
and I'll type sqlite3 votes.db | 4,203.53 | 4.71 |
to create a votes database. | 4,208.24 | 2.34 |
I'll hit Enter. | 4,210.58 | 1.05 |
And now, I can use .import. | 4,211.63 | 2.76 |
I could say .import a CSV called
votes.csv into a table also called | 4,214.39 | 7.05 |
votes. | 4,221.44 | 0.93 |
I'll Enter now. | 4,222.37 | 1.02 |
And now if I SELECT [? star ?]
FROM "votes" semicolon, | 4,223.39 | 4.89 |
I'll see all of my votes
now in a single table. | 4,228.28 | 4.93 |
So I want to tally these votes. | 4,233.21 | 1.83 |
And we could do that using a
technique we learned back in the week | 4,235.04 | 2.75 |
on querying and relating. | 4,237.79 | 2.22 |
What if I wanted to group by my
titles and count up those groups, | 4,240.01 | 4.92 |
I could do that. | 4,244.93 | 1.06 |
I could say SELECT, let's say,
"title," and also the COUNT of "title," | 4,245.99 | 5 |
and [? they ?] count up the votes
for each title FROM, in this case, | 4,250.99 | 4.54 |
my "votes" table like this. | 4,255.53 | 2.52 |
Now, I want to count not just each vote
individually, but I want to group them. | 4,258.05 | 5.46 |
I want to count votes by group
where that group is, in this case, | 4,263.51 | 4.36 |
the "title" itself. | 4,267.87 | 1.74 |
So let me try running this
query and hitting Enter. | 4,269.61 | 3.5 |
Well, [? I'll ?] [? see ?] I've
started to count some votes, | 4,273.11 | 4.26 |
like I have Imaginative landscape here,
Spring outing, Farmers working at dawn, | 4,277.37 | 5.76 |
Spring outing down below here too. | 4,283.13 | 1.98 |
But I seem to be missing something,
like I shouldn't have this many groups. | 4,285.11 | 3.84 |
I should only have four groups. | 4,288.95 | 1.62 |
Why do I have so many? | 4,290.57 | 2.37 |
Well, it seems like there
are some typos here. | 4,292.94 | 2.07 |
What typos do you see? | 4,295.01 | 2.65 |
Feel free to raise your hand. | 4,297.66 | 3.02 |
SPEAKER 15: So I think
that it is a title-- | 4,300.68 | 3.24 |
when you count it is case sensitive,
so maybe it is counting one by one. | 4,303.92 | 5.295 |
SPEAKER 1: Yeah, good idea. | 4,309.215 | 1.125 |
So maybe it's case sensitive our
[? GROUP ?] [? BY, ?] and you'd be | 4,310.34 | 3.33 |
correct if you said that. [? GROUP ?]
[? BY ?] is, in this case, | 4,313.67 | 2.88 |
case sensitive. | 4,316.55 | 1.36 |
So if we see here, we see
Farmers Working at Dawn, | 4,317.91 | 3.11 |
all capitalized, at least the
Farmers Working and Dawn capitalized. | 4,321.02 | 3.87 |
Well, that won't be
part of the same group | 4,324.89 | 2.34 |
as let's say Farmers working at dawn
all properly capitalized, in this case, | 4,327.23 | 6.36 |
with lowercase working and lowercase
dawn as it is the MFA collections. | 4,333.59 | 4.35 |
So we could probably fix
some capitalization here. | 4,337.94 | 3.42 |
What other things could we fix? | 4,341.36 | 1.88 |
So let's hear from one more person. | 4,343.24 | 2.425 |
Let's go to [? Lawrence. ?] | 4,345.665 | 1.125 |
SPEAKER 16: [? The ?]
[? count ?] on each typo. | 4,346.79 | 2.873 |
SPEAKER 1: There are some
typos in here, absolutely. | 4,349.663 | 2.167 |
So if I look at some of
these, I see not farmers, | 4,351.83 | 3.57 |
but [? Famers ?] working at dawn. | 4,355.4 | 2.22 |
I might see instead of
Imaginative landscape, | 4,357.62 | 2.79 |
I just see [? Imagintive ?]
landscape, so definitely some | 4,360.41 | 3.06 |
typos in here to fix as well. | 4,363.47 | 2.65 |
So let's start working on using our
[? UPDATE ?] tool or [? UPDATE ?] | 4,366.12 | 3.26 |
keyword to fix some of this data,
to clean it up, so to speak, | 4,369.38 | 3.85 |
so we can count up our
votes for these artworks. | 4,373.23 | 3.23 |
Come back to my [? TERMINAL. ?] And now,
let's try updating to at least remove | 4,376.46 | 6.09 |
some of this [? whitespace ?] here. | 4,382.55 | 1.62 |
You might notice that Imaginative
landscape has a space before it, | 4,384.17 | 3.73 |
and so does Spring outing here. | 4,387.9 | 1.67 |
That space counts as part of the
title, and I want to remove it. | 4,389.57 | 4.29 |
So what could I do? | 4,393.86 | 1.99 |
I could try using a function in SQLite,
one called [? trim. ?] [? Trim ?] takes | 4,395.85 | 5.9 |
a string and just removes leading and
trailing [? whitespace, ?] [INAUDIBLE] | 4,401.75 | 4.27 |
back only the characters in the middle. | 4,406.02 | 2.63 |
So let me try that. | 4,408.65 | 1.18 |
I'll say UPDATE "votes,"
my table here, and SET | 4,409.83 | 4.58 |
the "title" column equal to what? | 4,414.41 | 4.3 |
Well, the trimmed version of title. | 4,418.71 | 2.42 |
Trim looks like this-- | 4,421.13 | 1.68 |
trim, and then some parentheses
to say the input to this function. | 4,422.81 | 4.69 |
I'll give it the "title" column. | 4,427.5 | 2.12 |
Now, I'll hit semicolon. | 4,429.62 | 1.99 |
And this query will run as follows. | 4,431.61 | 2.64 |
It will update the votes table. | 4,434.25 | 2.12 |
And inside the votes table
set, the title column | 4,436.37 | 3.51 |
equal to the trimmed version of
whatever values are inside that column, | 4,439.88 | 5.07 |
trimming here means remove trailing
and leading [? whitespace. ?] | 4,444.95 | 4.26 |
I don't need to apply any condition. | 4,449.21 | 2.64 |
I don't need to say WHERE dot
dot dot, because I want this | 4,451.85 | 3.42 |
to apply to all rows in my data set. | 4,455.27 | 3.64 |
Now, I'll hit Enter. | 4,458.91 | 1.31 |
And let me try running this again. | 4,460.22 | 1.53 |
I'll say up arrow to
get back my old query. | 4,461.75 | 3.09 |
Now, I'll try counting again, and
I think we're making some progress, | 4,464.84 | 4.59 |
like I can see that I've removed-- | 4,469.43 | 2.19 |
[? removed ?] [? quote ?] [? unquote, ?]
those titles that had leading | 4,471.62 | 3.27 |
or trailing [? whitespace. ?]
They're now part of a group | 4,474.89 | 2.91 |
because their titles
now match those groups. | 4,477.8 | 3.6 |
Let's keep going. | 4,481.4 | 0.72 |
We noticed before, we had
some capitalization issues. | 4,482.12 | 2.5 |
So let's fix those as well. | 4,484.62 | 2.31 |
I can go back to my [? TERMINAL, ?] and
we could introduce this other function, | 4,486.93 | 3.74 |
one called [? upper. ?] | 4,490.67 | 1.5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.