text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
instead of writing literally delete from collection
5,893.27
3.06
where title equals Farmers Working At Dawn, I
5,896.33
2.34
could say update the deleted column of collections, where the title is Farmers
5,898.67
4.83
Working At Dawn, and make it not 0, but 1.
5,903.5
3.99
Now, I've marked this item as deleted.
5,907.49
3
I could run a query that excludes deleted items,
5,910.49
2.94
but this row is still around in my table.
5,913.43
4.45
So let's try implementing this idea of a soft deletion
5,917.88
3.53
inside of our collections table so that we
5,921.41
2.55
don't lose records of things that actually had in our collection.
5,923.96
4.35
I'll come back to my computer here, and let's work
5,928.31
2.94
on altering our table for collections here.
5,931.25
3.69
If I type dot schema collections--
5,934.94
3.42
dot schema collections, you should see I have a table "collections," and also
5,938.36
6.12
the triggers associated with it.
5,944.48
1.95
What I don't have yet in collections, if I go over here and show you,
5,946.43
3.99
I don't have a deleted column.
5,950.42
2.49
I have ID, title, accession number, and acquired, but I don't have deleted.
5,952.91
5.73
So as you learned last week, we can use alter table
5,958.64
3.75
to add a column to our collections table, and by default, make the value
5,962.39
5.16
0.
5,967.55
0.75
So let's try that.
5,968.3
1.64
I'll go back to my environment, and now I'll run alter table.
5,969.94
4.51
I might say alter table, and a table I want to alter, which is "collections."
5,974.45
6.99
Now I want to add the column "deleted" to collections,
5,981.44
5.49
and I want to make this type integer, so our whole numbers
5,986.93
3.48
whether positive or negative, and the default value will be 0 in this case.
5,990.41
5.61
Now, I'll hit Enter, and if I type dot schema collections,
5,996.02
5.19
I should see I have my very own deleted column inside of collections.
6,001.21
6.42
If I type, for instance, select star from collections semicolon,
6,007.63
6.49
I'll see that by default, all of these values are 0 in my new deleted column.
6,014.12
6.21
So instead of trying to literally delete from collections,
6,020.33
5.25
I could instead just update it.
6,025.58
1.65
I could say take the updated column, and flip it from a 0 to a 1.
6,027.23
4.65
Let me try update collections and set the deleted column
6,031.88
6.45
equal to 1, where let's say the title equals Farmers Working At Dawn.
6,038.33
7.5
And my query wraps here, but it should still work just fine.
6,045.83
3.07
I'll hit semicolon, Enter.
6,048.9
2.15
Now, I didn't use delete from.
6,051.05
2.55
I used update.
6,053.6
1.14
If I select star from collections semicolon here,
6,054.74
4.83
I'll see, well, Farmers Working At Dawn is in this table,
6,059.57
3.85
but technically-- at least we marked it as deleted.
6,063.42
4.14
So it seems now, I don't want to use just select star from collections
6,067.56
5.27
to see what's inside my collection.
6,072.83
1.71
I want to apply a filter to remove those that have
6,074.54
3.69
a deleted value that's not equal to 0.
6,078.23
3.515
Let's try this.
6,081.745
0.625
I'll say select star from collections where deleted does not equal 1.
6,082.37
8.28
If I hit semicolon here, what do I see?
6,090.65
3.06
Only those values that are not deleted.
6,093.71
3.808
I could go ahead and find them.
6,097.518
1.292
I could say maybe select star from collections where deleted actually
6,098.81
6.81
is 1.
6,105.62
1.08
Really equals 1 like this, and now I see all those rows
6,106.7
4.17
that I marked as deleted.
6,110.87
2.76
Now this has some advantages.
6,113.63
2.31
One of them is we keep data around.
6,115.94
2.03
We don't actually formally delete it.
6,117.97
1.56
We can still recover it later on, but it also has some tricky ethical questions,
6,119.53
4.93
too.
6,124.46
0.5
Like it's OK if we're talking about artwork here,
6,124.96
2.28
but if you're talking about user data, is it right to only soft delete it
6,127.24
5.28
if they ask you to delete it?
6,132.52
1.5
Particularly in conversation with new frameworks like GDPR,
6,134.02
3.78
and the right to be forgotten, and so on, it's up to you
6,137.8
2.77
as a programmer to make the right decision here.
6,140.57
2
When should you find data that [INAUDIBLE] and actually delete it,
6,142.57
2.91
or when is it better to just soft delete it and keep it around
6,145.48
3.09
in case you need it for later?
6,148.57
2.64
So we'll end here on this note where if I say select star from collections,
6,151.21
5.28
and I want to find those only where deleted is not equal to 0 like this--
6,156.49
7.08
or not equal to 1, this gives me back all of the items that are not deleted.
6,163.57
5.58
But wouldn't it be nice if I could actually
6,169.15
2.52
run a query on some brand new temporary table that actually only will ever have
6,171.67
5.91
those items that are not soft deleted?
6,177.58
2.67
Turns out, we can do that with an idea called views,
6,180.25
2.89
and we'll see those in much more depth next week.
6,183.14
2.99
We'll see you then.
6,186.13
1.88
[MUSIC PLAYING]
0
2.495
SPEAKER 1: Hello and welcome for Lecture 3 in React Native.
16.48
3.844
So previous lecture we talked about a bunch of different topics;
20.324
2.666
one being classes and how ES6 allows you to write classes.
22.99
4.23
React, we talked about the library by Facebook
27.22
2.73
that allows you to write declarative programming.
29.95
2.309
We talked about what imperative and declarative programming were
32.259
3.721
and how React allows you to write declaratively.
35.98
2.4
We talked about props, which are basically an object that
38.38
2.55
are passed down to elements.
40.93
1.71
We talked about state, which is a management system for allowing you
42.64
6.09
to track state in a class component.
48.73
3.06
We implemented the to do app in React and then we teased at something
51.79
3.57
called React Native.
55.36
1.71
And so this lecture we'll be talking a lot about React Native.
57.07
2.73
React Native is a framework that relies on React Core.
59.8
3
And so a lot of the paradigms that apply to React also apply to React Native.
62.8
4.79
And it allows us to build mobile apps using only JavaScript.
67.59
3.76
And so, as the React team like to say when this was released,
71.35
4.14
you can learn once and write everywhere.
75.49
4.11
And so React Native supports iOS and Android,
79.6
2.31