text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
Take it again from the top.
6,395.142
2.238
6,397.38
6.178
[MUSIC PLAYING]
0
4.9
CARTER ZENKE: Well, hello, one and all, and welcome to CS50's Introduction to
17.65
4.08
Databases with SQL.
21.73
1.8
My name is Carter Zenke.
23.53
1.62
And in this course, you'll learn how to represent, how to organize and manage,
25.15
4.77
and how to ask questions of the data that's around you
29.92
2.25
in your everyday life.
32.17
2.2
But why learn those skills?
34.37
2.24
Well, you may have heard we're living in the information age, where we generate
36.61
3.91
so much information, so much data by virtue of interaction
40.52
3.14
with computers and with each other over the internet.
43.66
3.07
You might think of, let's say, Google keeping track of the sites you click on
46.73
3.89
or the sites you search for.
50.62
1.65
You could think of maybe the smartphone in your pocket or the smartwatch
52.27
3.36
on your wrist keeping track of health information, emails,
55.63
3.13
text messages, and so on.
58.76
1.98
You might even think of YouTube, where you
60.74
2.15
might be watching this same video keeping track of all
62.89
2.64
the videos on their platform, the creators of those videos,
65.53
2.94
and even the comment you might leave on this video.
68.47
3.72
So although, we're living in this information age, where
72.19
2.94
there is so much data, so much information,
75.13
2.64
we can use these new tools, like database and SQL,
77.77
2.43
to interact with that information to store it and manage it.
80.2
3.718
And although we're using some of these new tools,
83.918
2.042
some of the other concepts we'll learn aren't actually so new.
85.96
3.6
So here is a diagram from literally a few thousand years ago.
89.56
5.13
And notice how this diagram has rows and columns.
94.69
4.71
And this seems to store the stipends for workers at a temple
99.4
3.87
some few thousand years ago.
103.27
1.9
So given what you know based on your prior knowledge, what kind of name
105.17
5.03
might you give this diagram with rows and with columns?
110.2
4.83
What can we give a name to for this?
115.03
3.09
So I'm seeing some ideas of a table, perhaps a spreadsheet as well.
118.12
4.41
For our purposes, we'll call this a table, where
122.53
2.73
a table stores some set of information.
125.26
2.999
And every row in that table stores one item
128.259
4.111
in that set, where every column has some piece of information
132.37
3.39
about that item, some attribute of that item.
135.76
2.83
So here, for example, we do have a table of workers at a temple.
138.59
3.95
Every row is one worker.
142.54
2.25
And every column is their stipend for a particular month.
144.79
4.42
So I could take this idea of a table, this very ancient idea,
149.21
3.8
and apply it to a more modern context.
153.01
2.65
So let's say I'm a librarian, for instance.
155.66
3.15
I want to organize my library.
158.81
2.42
Well, here I have book titles and authors.
161.23
3.3
And I could certainly use a table to store this information.
164.53
2.88
But how might you propose I store this information?
167.41
3.96
What could I do with my rows and with my columns
171.37
3.27
if I have book titles and book authors?
174.64
3.66
I see one thing I could do is probably organize my titles and my authors
178.3
5.1
next to each other like this.
183.4
1.778
I could take my titles to my authors, put them right next together.
185.178
2.792
So I have Song of Solomon by Toni Morrison,
187.97
2.45
Goodnight Moon by Margaret Wise Brown.
190.42
1.89
And notice hear how each book is one row.
192.31
3.67
But every row has two columns worth two pieces of information for each book.
195.98
5.66
I have a title for one column and an author for the other.
201.64
4.33
And so together, I have a table of books where every column tells me
205.97
3.98
one piece of information.
209.95
1.26
And every row tells me one book in this data set.
211.21
5.23
So thankfully, now that we're living in this information age,
216.44
4.01
we no longer have to use stone tablets or perhaps pencil and paper
220.45
5.31
to store our tables.
225.76
1.35
We have software now like Apple Numbers, Google Sheets, and Microsoft Excel.
227.11
4.44
But this isn't a course on Apple Numbers or Microsoft Excel or so on.
231.55
5.5
It's actually a course on databases and on SQL.
237.05
3.29
So feel free to raise your hand if you'd like, but why
240.34
3.63
would we decide to move along from these spreadsheet
243.97
3.39
softwares towards a database?
247.36
3.06
What might that database give us that a spreadsheet might not give us?
250.42
4.2
So I'm seeing a few ideas here and among them are some simplicity,
254.62
3.719
some ability to organize some data.
258.339
2.506
But there are a few other ideas which I think
260.845
1.875
about too for why we might move beyond spreadsheets and go towards databases.
262.72
4.02
Now one of these is this idea of scale.
266.74
2.79
So let's say you are a Google or an Instagram.
269.53
3.3
You're trying to store not just tens of thousands
272.83
2.28
of users or hundreds of thousands but literally
275.11
2.04
millions of users or billions of users.
277.15
2.7
And with that kind of scale may be better served by a database
279.85
3.6
to store that much information.
283.45
2.8
Another reason to move from spreadsheets to databases
286.25
3.65
is the idea of being able to update data more frequently.
289.9
3.27
Maybe you're a Twitter of the world, and you're
293.17
2.01
trying to have others tweet multiple times per second.
295.18
2.88
Well, a database can handle that kind of capacity
298.06
2.85
much better than a spreadsheet could alone.
300.91
3.15
And a third reason to move beyond this might be speed.
304.06
4.12
Let's say I'm trying to look up some piece of information in my database.
308.18
3.63
Well, I could do that much faster with a database
311.81
2.51
than I could with a spreadsheet.
314.32
1.35
You could think of yourself using Command-F or Control-F to find
315.67
2.73
a piece of information in your spreadsheet,
318.4
1.86
going one by one through the rows.
320.26
2.07
A database gives you access to more kinds
322.33
2.22
of algorithms you could use to search this data much faster, ultimately.
324.55
3.99