And so, there are some text fields that,
the key to the text fields is that they're not indexable in the same way.
Sorting, like the ORDER BY, doesn't work so well with them.
But if you're putting in a blog post or a comment in Facebook,
you'd probably put one of these things in.
They all have a maximum length.
The TEXT field is up to 65,000 characters, because it might be a small blog post, or
MEDIUMTEXT, or LONGTEXT, you can have 4 gigabytes of text, of characters.
Now, because this is character-set-aware field, they're real characters.
And so, 65,000 Latin characters is the same as 65,000 Asian characters.
And it's capable of handling all that.
So the TEXT field and the VARCHAR field understand character sets.
Now, the types that are very rarely used are byte types.
And so, in the Latin character set, using ASCII,
a character is 8 bits, that's just how big it is.
And so, if all you're doing is Latin, one character is 8 bits.
Whereas, if you're doing other Unicode things, characters can be up to 32 bits,
whereas a byte is exactly 8.
And so, you can tell, if it's binary data and you know, really,
that it's only up through values from 0 through 255 characters,
you can say, hey, I'd like a binary stuff, like a BYTE field or
a variable length binary field, up to that many bytes.
It's not really commonly used if you don't want to index,
if you don't want to sort it.
It's sort of not aware, it's very unaware of its content.
But sometimes you're putting stuff in, you're pulling something off,
perhaps a sensor or something, and you're just putting it in, and
it's just a bunch of 0s and 1s.
That's what this is used for.
You can also store things like images or PDFs or videos in databases.
It turns out that databases are pretty good at this, and these are called BLOBs,
binary large objects.
And they also have various lengths, depending on whether they're tiny,
regular, medium or long.
So it turns out the databases are really good at storing this stuff, but
the problem you run into is that it starts to slow your database backup down
quite a bit after a while.
And so, what you find is that if you're doing medium-size things, like maybe
a picture here and there, or a profile photo or something, we tend to put that
in the database because then it's kind of with all the rest of the data about you.
But if we're doing things like videos or large documents,
we tend to find some other way to store them inside the computer,
usually just as a file somewhere, and then we serve them up.
But it's not bad to store binary objects like this in a database,
except when it comes to your backup getting too large.