text
stringlengths 1
81
| start
float64 0
10.1k
| duration
float64 0
24.9
|
|---|---|---|
this value for me.
| 692.18
| 1.44
|
Let me try leaving
off "id" in this case.
| 693.62
| 2.82
|
I'll omit the "id"
altogether, which seems
| 696.44
| 2.91
|
at first like a bit of a bad
thought, like shouldn't every row
| 699.35
| 2.82
|
have its own id?
| 702.17
| 1.11
|
Well, let's just try and
figure out what happened.
| 703.28
| 2.55
|
I'll hit Enter here.
| 705.83
| 1.23
|
And now I'll say, let
me give the VALUES.
| 707.06
| 2.5
|
Well, now the first column
is the title column.
| 709.56
| 3.21
|
So I'll go ahead and say that this
one will be called "Spring outing."
| 712.77
| 3.2
|
We're going to add this
one to our collection here.
| 715.97
| 2.55
|
The accession number,
in this case, is 14.76.
| 718.52
| 3.09
|
And we acquired this one all the way
back in 1914-01-08 [? semicolon. ?]
| 721.61
| 6.93
|
So I'll hit Enter here.
| 728.54
| 1.63
|
And notice how there's no
[? id ?] that I have specified.
| 730.17
| 3.17
|
But now if I hit Enter, seems to work.
| 733.34
| 3.51
|
I'll type SELECT [? star ?]
[? FROM ?] "collections,"
| 736.85
| 3.27
|
and what do I see but
the new primary key of 3.
| 740.12
| 4.59
|
So it seems like SQLite actually
increments the primary key for me.
| 744.71
| 5.58
|
If I add some new row, it looks, what
is the current highest primary key
| 750.29
| 4.89
|
and adds 1 to that automatically for me.
| 755.18
| 2.94
|
And I've gotten that by
specifying in my schema
| 758.12
| 3.27
|
this primary key
constraint down on line 6.
| 761.39
| 3.66
|
So pretty handy for me here.
| 765.05
| 2.79
|
I see a few other questions too.
| 767.84
| 2.19
|
So let's take those
before we move on as well.
| 770.03
| 4.54
|
Let's go to [? Andre. ?]
| 774.57
| 1.19
|
SPEAKER 3: I just want to ask
if I delete the, let's say,
| 775.76
| 3.27
|
the [? first ?] record and type again,
will it number it [? on ?] the fourth
| 779.03
| 7.38
|
number or the first one.
| 786.41
| 1.093
|
SPEAKER 1: A great question.
| 787.503
| 1.167
|
We'll see this a little
bit later on too.
| 788.67
| 1.708
|
But if I delete some row, let's say, I
deleted the row with primary key of 1,
| 790.378
| 4.612
|
well, what SQLite will
do, at least by default,
| 794.99
| 3
|
is actually take the highest value.
| 797.99
| 2.07
|
Let's say the highest value
is still three in my database.
| 800.06
| 3.28
|
It will add 1 to that, and I
want to insert that new row it'll
| 803.34
| 3.17
|
have the [? id ?] of 4 in this case.
| 806.51
| 3.163
|
OK, so let's explore a bit more
some of these constraints on tables.
| 809.673
| 4.757
|
Here, we're talking about the primary
key constraint, but we also have,
| 814.43
| 3.42
|
as we saw before, the
[? NOT ?] [? NULL ?] constraint
| 817.85
| 2.46
|
and the [? UNIQUE ?] constraint.
| 820.31
| 1.69
|
So let's try inserting given
those constraints here.
| 822
| 3.23
|
[? I'll go ?] back to my computer.
| 825.23
| 2.05
|
And again, notice in my schema,
I specified that this "title"
| 827.28
| 5.06
|
column should always be NOT NULL.
| 832.34
| 3.172
|
It should never have a
[? null ?] value inside of it.
| 835.512
| 2.208
|
And similarly, "accession_number"
should also be NOT NULL.
| 837.72
| 3.56
|
It should also be [? unique. ?]
I should have no two rows
| 841.28
| 3.99
|
that have the same accession number.
| 845.27
| 2.28
|
And maybe kind of a
playfully, subversively here,
| 847.55
| 3.75
|
let's try to run
against this constraint.
| 851.3
| 2.158
|
Let's actually try to add the same
accession number and see what happens.
| 853.458
| 3.042
|
So I'll come back to my
[? TERMINAL. ?] Let me just reinsert,
| 856.5
| 4.4
|
let's say "Spring outing."
| 860.9
| 1.59
|
Notice how if I SELECT [? star ?] FROM
"collections," it's already in here.
| 862.49
| 4.81
|
But I'll try to add it yet again with
the same [? accession ?] [? number. ?]
| 867.3
| 3.45
|
So I'll say INSERT INTO "collections."
| 870.75
| 1.658
|
And by now this is [? hopefully ?]
[? becoming ?] a little more familiar.
| 872.408
| 3.042
|
I now want to say the columns
I want to add data to.
| 875.45
| 3.42
|
So I'll say the "title" column,
the "accession_number" column,
| 878.87
| 7.65
|
and also the "acquired"
date I'll hit Enter.
| 886.52
| 3.03
|
And now I'll say the VALUES again.
| 889.55
| 2.07
|
Let's reinsert [? "Spring ?]
[? outing." ?] I'll say "Spring outing"
| 891.62
| 3.03
|
as a title, the accession
number is 14.76,
| 894.65
| 3.99
|
and the date it was acquired
was again 1914-01-08 semicolon.
| 898.64
| 6.03
|
Now if I hit Enter, what do we see?
| 904.67
| 4.43
|
Runtime error-- UNIQUE
constraint failed.
| 909.1
| 3.39
|
So it seems we ran
against this constraint
| 912.49
| 2.4
|
here that we specified on line 4 here.
| 914.89
| 3.57
|
[? "Accession number" ?]
should always be unique.
| 918.46
| 2.37
|
But by trying to add a new row that
had that same accession number,
| 920.83
| 3.99
|
we ran into this runtime error and
our operation was not completed.
| 924.82
| 4.96
|
If I say in this case, SELECT
[? star ?] FROM "collections,"
| 929.78
| 3.41
|
notice how I guarded myself from
adding Spring outing more than once
| 933.19
| 4.86
|
with the same accession number.
| 938.05
| 2.02
|
So some usefulness here to
these kinds of constraints.
| 940.07
| 3.56
|
Let's try violating NOT NULL too.
| 943.63
| 2.55
|
I'll try adding a title that is
actually [? null, ?] non-existent.
| 946.18
| 3.072
|
It's trying to add a painting
without a title itself.
| 949.252
| 2.208
|
Let's try this.
| 951.46
| 0.96
|
I might try INSERT INTO
the "collections" table,
| 952.42
| 3.6
|
and I'll add to the "title" columns,
the "accession_number," and also
| 956.02
| 5.64
|
the "acquired" column.
| 961.66
| 2.28
|
Now, I'll say the VALUES here.
| 963.94
| 2.08
|
But remember, this [? null ?] value.
| 966.02
| 1.85
|
Null meaning nothing.
| 967.87
| 1.41
|
This value doesn't exist.
| 969.28
| 1.35
|
I could insert that into my
table, or at least try to.
| 970.63
| 3.63
|
I'll say NULL is a title.
| 974.26
| 2.43
|
And similarly, NULL is
the accession number.
| 976.69
| 2.92
|
Now let's say, just playfully, we
got this painting back in 1900-01-10
| 979.61
| 5.84
|
like this.
| 985.45
| 1.32
|
OK now, semicolon.
| 986.77
| 2.19
|
I'll hit Enter, and we see the same
runtime error-- constraint failed,
| 988.96
| 5.01
|
in this case, the NOT NULL constraint.
| 993.97
| 2.23
|
So notice again how in my schema, I
specified "title" should be NOT NULL.
| 996.2
| 5.75
|
But here when I try to insert a
[? null ?] [? value, ?] I run into that
| 1,001.95
| 4.14
|
constraint and I can't
insert that value.
| 1,006.09
| 2.58
|
If I try to SELECT [? star ?]
FROM "collections,"
| 1,008.67
| 2.73
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.