Check out a free preview of the full Full Stack for Front-End Engineers, v2 course:
The "Database Types" Lesson is part of the full, Full Stack for Front-End Engineers, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Jem compares relational databases and non-relational databases, explains their main differences, and describes the context in which each one is used.

Get Unlimited Access Now

Transcript from the "Database Types" Lesson

>> Jem Young: The first type of database, which you've probably all heard of is a relational database. That would be known as the SQL database, or SQL, Safe or Structured Query Language. I think it depends on where you went to school, or like where you grew up. If you say SQL or SQL, doesn't matter.

[00:00:18] Just like some people say integral, and other people say integral, doesn't really matter. Relational databases describe how entities relate to each other. And they invariably always use tables and it has a very strict structure on how data should be formed and how should be written and how should be read, and it's really, really strict.

[00:00:41] In fact, if you've ever done any sort of SQL using MySQL or postures or something like that, it can be cumbersome selects ID from this table, left join on this and it's own language, becoming a database administrator or a database expert is its own special field. You literally could go to school for like two years for just the US databases.

[00:01:02] But you need it because when you have massive amounts of data, you need a structured way of querying that data. That's the invention of relational databases and Structured Query Language, a common language on how to access all these. Depending on your type of database, the language might change a little bit.

[00:01:20] So something like Costco is gonna use a different language than MySQL. But generally, they kind of all work the same way if you imagine how they're structured. I think the problem that people get hung up with structure query language is you can't just write things for database and like, I'll figure it out.

[00:01:37] I'll figure it out as we go along. You have to have a structure ahead of time and you have to have a very strict, what is that, it's a schema. And when you have a schema, it's just saying these are strict rules. So this column for is a member of front of masters, that's gonna be a Boolean type, which is gonna be represented by 1 or 0.

[00:01:56] And it can't be anything else. And if you try to write something else to it, it's gonna fail, because it's all about maintaining a strict structure over time. Now, SQL in relational databases were the first time, but over time you've probably heard of non relational databases, or NoSQL databases.

[00:02:13] These are more what we were thinking about when we think of pure document storage. They're generally data agnostic, they don't care what kind of data you put in there, there's no structure to it. Or if there is a structure, it's a very, very loose structure. So an example of a NoSQL database or non relational be redis is the famous one, MongoDB used to document store or elasticsearch.

[00:02:37] The thing about non relational database which I find really interesting is they all have their own kinda unique place in the world. So redis is really good at it as a cash database. Redis is just a key value store. Given a key, here's a value. I won't say as simple as it can get cuz like it the queries can get pretty messy.

[00:02:58] But if terms of how to save data, my name is Jim, my last name is young. That's as simple as it gets. So we can create a caching server with redis if we needed to, and we spoke earlier about caching. One way of doing that is with a redis database.

[00:03:12] Mongo, on the other hand, is a document store. So it's made to specifically store documents. So think a key with an arbitrary JSON blob, and the thing about JSON is it doesn't necessarily have the same structure all the time. It's not a structured notation per se, has a structure but it's pretty loose.

[00:03:28] We're MongoDB is about just dumping data into a data store and pulling it back out. Some other ones you might have heard of would be redshift on Amazon. That's a very large and like petabyte scale database. Built on the old version of Postgres, and it's now since shifted.

[00:03:45] What are some other databases you all have heard of or have used? There's a lot.
>> Speaker 2: Firebase.
>> Jem Young: Firebase, I don't know if that's a database per se. It is? Okay, learnt something new today. I thought it's more of a type of connection.
>> Speaker 3: Well, that's it's a database coupled with the live data.

>> Jem Young: Yeah, thought is more of like a protocol of sorts, but-
>> Speaker 3: It's non relational database in Google's cloud.
>> Jem Young: Hey, that's awesome. I didn't know that firebase good example. Any other ones?
>> Speaker 3: CouchDB.
>> Jem Young: CouchDB, any other ones?
>> Speaker 3: PouchDB.
>> Jem Young: PouchDB, yeah, anything else that rhymes with ouch DB?

>> [LAUGH]
>> Jem Young: There's actually a database built into your browser called IndexedDB. Not a lot of people use it, but it's available. Because we thought, hey, we have all these databases, why not just use a database built into the browser? Yes.
>> Speaker 3: Aren't blockchains databases, kinda?
>> Jem Young: I don't know if I call blockchain a database per se.

[00:04:56] It depends how we're defining database. We're saying like it's a raw store of data. Yes, but I wouldn't say it's like variable per se. It's not built to be variable. You I think the query, you have to run through the entire blockchain to find what you're looking for, as far as I know.

[00:05:11] What's fascinating about the non relational database side? The NoSQL side is people are constantly creating new databases. Because they have some very unique case that requires like speed or consistency, or something like that, versus the non relational databases which are more about being able to query data efficiently, and be able to look things up quickly and modify things quickly.

[00:05:33] Whereas non relational, it's gonna take a little bit more time. If you're just trying to get documents out as fast as possible, this could be a little bit faster, generally speaking. Any questions on databases? We just flew through those. I didn't wanna get into any specific one because it really depends on your used case.