We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Relational vs. Non-Relational DBs

The big difference between relational and non-relational databases is that non-relational databases tend to nest their data. Instead of always keeping records in separate tables, they often store records within other records.

To over-simplify it, you can think of non-relational databases as giant JSON blobs. If a user can have multiple courses, you might just add all the courses to the user record.

{
  "users": [
    {
      "id": 0,
      "name": "Elon",
      "courses": [
        {
          "name": "Biology",
          "id": 0
        }
      ]
    },
    {
      "id": 1,
      "name": "Curly",
      "courses": [
        {
          "name": "Biology",
          "id": 0
        }
      ]
    }
  ]
}

This often results in duplicate data within the database. That's obviously less than ideal, but it does have some benefits that we'll talk about later in the course.

Relational Database

Non-Relational Database