text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
Here I have three columns for
three pieces of information | 139.26 | 3.15 |
that I might want to keep track
of for any particular flight. | 142.41 | 2.73 |
For any given flight I might
want to know that flight's | 145.14 | 2.292 |
origin, what city it's weaving from. | 147.432 | 1.578 |
Its destination, what
city it's arriving at. | 149.01 | 2.37 |
And its duration, some
value in minutes of how long | 151.38 | 3 |
it's going to take the flight to get
from the origin to the destination. | 154.38 | 3.79 |
So each of those columns
represents one field | 158.17 | 2.18 |
that I might want to keep
track of about my data. | 160.35 | 2.34 |
And each row, meanwhile, is going
to represent an individual flight. | 162.69 | 3.81 |
So here, for example, is one row
representing one flight from New York | 166.5 | 3.78 |
to London and that flight just
so happens to take 415 minutes. | 170.28 | 5.01 |
And so what SQL is
going to allow us to do | 175.29 | 2.04 |
is it is going to be a
database of language that | 177.33 | 2.49 |
is designed to interact with
relational database management systems. | 179.82 | 3.84 |
Databases that organize data into tables
where every table has rows and columns. | 183.66 | 4.95 |
And it turns out, there are a number of
different database management systems | 188.61 | 3.21 |
that implement parts of the SQL
standard of this type of language. | 191.82 | 3.36 |
Some of the more popular are
MySQL, PostgreSQL, and SQLite | 195.18 | 3.84 |
but there are definitely others as well. | 199.02 | 1.667 |
And each of these has various different
features and different use cases | 200.687 | 3 |
where some might be more appropriate. | 203.687 | 1.653 |
MySQL and PostgreSQL, otherwise
known as just Postgres, | 205.34 | 3.88 |
are more heavier database
management systems, so to speak. | 209.22 | 3.63 |
They're generally running on servers
elsewhere where a lot of big companies | 212.85 | 4.11 |
will use servers like this
in order to store data | 216.96 | 2.613 |
and represent their data in a
sort of a separate database where. | 219.573 | 2.667 |
The idea of that is that you might
want your web application running | 222.24 | 2.88 |
on one server but you
might want your database | 225.12 | 1.933 |
running as an entirely separate process. | 227.053 | 1.667 |
Such that they can behave independently,
you can debug and test them | 228.72 | 2.97 |
independently, and if one goes down,
the other doesn't go down as well. | 231.69 | 4.32 |
SQLite is a bit of a
simpler lighter weight | 236.01 | 2.43 |
implementation of the SQL standard. | 238.44 | 1.98 |
And what SQLite is going to do is
rather than be an entire server that | 240.42 | 3.41 |
is going to be listening for
requests and making responses, | 243.83 | 2.77 |
SQLite is just going to store
all of its data as a single file. | 246.6 | 3.55 |
So we're going to store SQL
data inside of a SQLite file | 250.15 | 2.48 |
and that's going to make it
a little bit easier for us | 252.63 | 2.25 |
as we're just getting started to
begin to write queries and add things | 254.88 | 3.3 |
to our database and retrieve
things from our database. | 258.18 | 2.43 |
But know that many of the same types of
SQL syntax that we'll see with SQLite, | 260.61 | 3.54 |
which is Django's default,
can also be applied | 264.15 | 2.58 |
to other languages as well and other
database management systems too. | 266.73 | 4.32 |
So as we begin to store data
inside of a SQL database, | 271.05 | 3.12 |
ultimately each of those
pieces of data has a type. | 274.17 | 2.997 |
In the same way that
in Python we have types | 277.167 | 1.833 |
for various different types of data,
we have integers and we have strings | 279 | 3.33 |
and we have lists and
tuples and so forth. | 282.33 | 2.04 |
SQL too has types that represent various
different categories of information | 284.37 | 4.8 |
that you might want to
store inside of a database. | 289.17 | 2.2 |
And each database management system
has its own different set of types. | 291.37 | 3.29 |
SQLite for example, has a fairly short
list of basic types that it supports. | 294.66 | 4.92 |
It supports text for just like
strings of text, for example. | 299.58 | 3.66 |
Something like a city name, for
instance, might be stored as text. | 303.24 | 3.12 |
We have support for integers,
which are just 0, 1, 2, 3 4 | 306.36 | 3.3 |
plus the negative numbers, negative 1,
negative 2, negative 3, and so forth. | 309.66 | 4.45 |
We have support for real
numbers where real numbers don't | 314.11 | 2.48 |
have to just be integers, they can
have something after the decimal point. | 316.59 | 3.29 |
Something like 2.8 or something else
that might have a decimal in it. | 319.88 | 3.51 |
And then numeric is another category
for data that's just more generally | 323.39 | 3.57 |
some sort of number that
might number like data, | 326.96 | 2.41 |
so something like a Boolean value or
something like a date, for example, | 329.37 | 3.98 |
might be stored using this numeric type. | 333.35 | 1.68 |
Where it's not really an
integer or a real number, | 335.03 | 2.083 |
though you could represented at such,
it's other numeric type of data. | 337.113 | 3.987 |
And then finally blob, which
stands for binary large object, | 341.1 | 3.41 |
is any type of other binary data. | 344.51 | 1.86 |
Just zeros and ones that you might
want to store inside of your database. | 346.37 | 3.61 |
So for example, if you're
storing files, maybe they're | 349.98 | 2.27 |
audio files or images
or other types of files | 352.25 | 2.43 |
that you want to keep track
of inside of your database, | 354.68 | 2.62 |
you can store just pure binary data
inside of a SQL database as well. | 357.3 | 4.71 |
So these now are the basic
types of SQLite supports | 362.01 | 3.02 |
but other database
management systems have | 365.03 | 1.83 |
other types that they support as well. | 366.86 | 1.59 |
MySQL, you all for example, has
a much longer list of other types | 368.45 | 3.24 |
that it supports. | 371.69 | 1.08 |
In addition to just supporting a
text type for arbitrary length text, | 372.77 | 3.57 |
MySQL also has a type called char
that takes an argument of size. | 376.34 | 4.41 |
For saying I want like size
characters worth of data | 380.75 | 3.12 |
that we're going to store
inside the database. | 383.87 | 1.92 |
And you might imagine that this
can be advantageous in situations | 385.79 | 3.06 |
where you know that
your data is going to be | 388.85 | 1.92 |
within a certain number of characters. | 390.77 | 1.68 |
So if you're storing a zip code
for example, in the United States. | 392.45 | 3.24 |
A zip code in the United States
might just be five characters | 395.69 | 2.97 |
and so you can allocate
a character length | 398.66 | 1.77 |
of five characters worth of space
for storing every single zip code | 400.43 | 3.81 |
inside of your database table. | 404.24 | 1.385 |
So for efficiency's sake, if
you know the maximum length, | 405.625 | 2.755 |
and you can fix that length
inside your database, | 408.38 | 2.61 |
that can be an efficient choice. | 410.99 | 1.59 |
VARCHAR of a size is similar. | 412.58 | 2.07 |
And this is a variable length character. | 414.65 | 2.07 |
If something isn't going to be exactly
a certain number of characters, | 416.72 | 3 |
but maybe up to a certain
number of characters, | 419.72 | 2.34 |
you can use VARCHAR to
say maybe sometimes it's | 422.06 | 2.1 |
going to be fewer characters. | 424.16 | 1.47 |
But it could be up to
size, number of characters. | 425.63 | 3.21 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.