text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
Could we use MAX and MIN to find
the longest or shortest string? | 4,293.71 | 3.33 |
That's a good question. | 4,297.04 | 1.1 |
So let's actually pause on this counting
here and try that out real quick. | 4,298.14 | 3.43 |
So I'll come back to my terminal. | 4,301.57 | 1.87 |
And let me try to use MAX and
MIN with some book titles. | 4,303.44 | 4.04 |
So I'll say Select-- | 4,307.48 | 2.61 |
let's select the MAX title. | 4,310.09 | 2.7 |
And at the same time, why don't
we select the MIN title as well? | 4,312.79 | 4.99 |
And I'll select these
from my "longlist" table. | 4,317.78 | 3.14 |
I'll hit Semicolon. | 4,320.92 | 1.45 |
And now, let me try this out. | 4,322.37 | 2.74 |
I'll get back Wretchedness
and A New Name-- | 4,325.11 | 3.99 |
Septology VI-VII. | 4,329.1 | 3.47 |
Now, there's a few hypotheses here. | 4,332.57 | 2.37 |
It does seem that our MAX "title"
is shorter than our MIN "title." | 4,334.94 | 4.59 |
So it's probably not that MAX
gives us the length of the string, | 4,339.53 | 4.33 |
but what do you notice? | 4,343.86 | 1.56 |
Well, I see MIN is really
early on in the alphabet. | 4,345.42 | 3.515 |
It has an A here, whereas MAX has
a W, pretty low in the alphabet. | 4,348.935 | 5.355 |
And I would bet if we
ordered these book titles, | 4,354.29 | 3.03 |
we would see a new name up at the very
top and a Wretchedness, the book here, | 4,357.32 | 5.82 |
down at the bottom. | 4,363.14 | 1.57 |
So MAX seems to give us the
lowest alphabetically, which | 4,364.71 | 4.04 |
is kind of contradictory
with titles here or strings. | 4,368.75 | 2.88 |
And MIN gives us the earliest in
the alphabet using this A as well. | 4,371.63 | 6.56 |
OK. | 4,378.19 | 0.75 |
So a good question. | 4,378.94 | 0.97 |
Let's come back to our counting here. | 4,379.91 | 1.93 |
Let's go back to my terminal. | 4,381.84 | 1.24 |
And again, we had, in this case,
78 rows, but only 76 translators. | 4,383.08 | 6.06 |
So, again, if I did SELECT
COUNT star from, let's say, | 4,389.14 | 3.57 |
"longlist" then
Semicolon, I get back 78. | 4,392.71 | 4.29 |
But if I do SELECT COUNT of "translator"
from "longlist," I get back 76. | 4,397 | 8.28 |
And let me ask again, why do we
have 78 rows but 76 translators? | 4,405.28 | 6.36 |
Feel free to say it. | 4,411.64 | 2.495 |
OK, so I'm seeing maybe we
have some number of rows, 78. | 4,414.135 | 5.215 |
But for our translators, you remember,
two of those were null values. | 4,419.35 | 4.5 |
They didn't exist in our table. | 4,423.85 | 1.96 |
So it seems like if we use COUNT
star, we're counting all the rows. | 4,425.81 | 4.83 |
But if we use COUNT "translator,"
some column that has null values, | 4,430.64 | 4.07 |
we're only getting back those rows
or those values that aren't null. | 4,434.71 | 4.3 |
So COUNT, when given a
column, counts only those that | 4,439.01 | 3.05 |
are not null that exist in our table. | 4,442.06 | 4.56 |
OK, let's look at one more
example here for counting. | 4,446.62 | 2.62 |
And let's try this. | 4,449.24 | 2.74 |
Let's say I want to find all of
the publishers in this database. | 4,451.98 | 4.1 |
I'll say SELECT COUNT of
"publisher" from my "longlist." | 4,456.08 | 6.15 |
And I'll hit Semicolon. | 4,462.23 | 2.16 |
So you might think that I have
78 publishers in this long list. | 4,464.39 | 5.94 |
But would it be accurate
if I were to say | 4,470.33 | 1.86 |
I have 78 different
publishers in this longlist? | 4,472.19 | 4.97 |
Could I say that? | 4,477.16 | 2.92 |
I'm seeing no, right? | 4,480.08 | 1.47 |
I couldn't try to count
up these publishers | 4,481.55 | 2.73 |
and then say I have 78 different ones. | 4,484.28 | 1.98 |
I might double count the
publisher along the way. | 4,486.26 | 3.12 |
And let me show you what we mean here. | 4,489.38 | 1.72 |
So I'll go back to my table. | 4,491.1 | 1.58 |
And let me try to select from publishers
or select the publisher column | 4,492.68 | 4.68 |
from longlist. | 4,497.36 | 1.17 |
I'll select "publisher" from "longlist." | 4,498.53 | 3.57 |
Hit Semicolon. | 4,502.1 | 1.77 |
Oops, and now I see
something a little odd. | 4,503.87 | 2.82 |
Let me scroll back up and maybe
ask for a raised hand here. | 4,506.69 | 6.38 |
Why might I get this odd result? | 4,513.07 | 6.49 |
SPEAKER: Because of the quotes? | 4,519.56 | 1.758 |
CARTER ZENKE: Yeah. | 4,521.318 | 0.792 |
So I think I mistyped
some of my query here. | 4,522.11 | 2.25 |
I said it looks like "pubsliher"
instead of "publisher." | 4,524.36 | 4.29 |
And in this case, SQL will
give me what I asked for. | 4,528.65 | 3.21 |
I said SELECT "pubsliher"
from "longlist." | 4,531.86 | 2.54 |
And says, OK, here it is. | 4,534.4 | 1.36 |
But that column doesn't exist
so it creates this data for me. | 4,535.76 | 3.07 |
So let me try this again. | 4,538.83 | 2.03 |
I'll go back. | 4,540.86 | 0.66 |
And I'll hopefully type
this correctly now. | 4,541.52 | 1.95 |
I'll say SELECT, let's say, "publisher,"
this one, FROM "longlist" Semicolon. | 4,543.47 | 8.89 |
And now I'll see all of the
publishers that I have in my table. | 4,552.36 | 4.91 |
But what do you see? | 4,557.27 | 0.848 |
Well, some repeat, right? | 4,558.118 | 1.042 |
I have Harvill Secker
multiple times here. | 4,559.16 | 3.18 |
I have similarly MacLehose
Press multiple times as well. | 4,562.34 | 3.67 |
So if I count it up,
these publishers, I would | 4,566.01 | 3.11 |
get each one counted one
time, which I want to find | 4,569.12 | 3.6 |
the distinct ones the different ones. | 4,572.72 | 2.04 |
I need a new keyword for this. | 4,574.76 | 2.04 |
And for this, we'll use this keyword
indeed called DISTINCT, trying | 4,576.8 | 3.39 |
to find unique values from our column. | 4,580.19 | 3.46 |
So let's try this. | 4,583.65 | 1.31 |
I'll go back over here and I will
now select not just publishers, | 4,584.96 | 5.4 |
but distinct publishers. | 4,590.36 | 1.71 |
I'll say SELECT DISTINCT publisher
from "longlist" Semicolon. | 4,592.07 | 7.75 |
Now, if I scroll through here, I
should see each publisher in here | 4,599.82 | 5.1 |
only one time. | 4,604.92 | 1.83 |
If they have the same name,
they've been filtered out. | 4,606.75 | 2.58 |
And now they're only the
same publisher here too. | 4,609.33 | 3.21 |
So I will then try to
say SELECT, let's say, | 4,612.54 | 2.31 |
COUNT of "publisher," SELECT
COUNT of "publisher" from-- | 4,614.85 | 6.167 |
COUNT of DISTINCT
"publisher," for instance. | 4,621.017 | 1.833 |
COUNT distinct publisher-- oh, typo,
"publisher" FROM "longlist" Semicolon. | 4,622.85 | 12.29 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.