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

You're on assignment part 1/2 for this lesson.

Relational Databases

We have been using the term relational quite a bit. It's time we actually go over what that means!

A relational database is a type of database that stores data so that it can be easily related to other data. For example, a user can have many tweets. There's a relationship between a user and their tweet.

In a relational database:

  1. Data is typically represented in "tables."
  2. Each table has "columns" or "fields" that hold attributes related to the record.
  3. Each row or entry in the table is called a record.
  4. Typically, each record has a unique Id called the primary key.

Example Relational Database

Here is an example of a small relational database. This database has 3 tables, Students, Courses, and StudentCourses. The StudentCourses table manages the relationship between the Students and Courses tables.

Example 1: Curly

  • Curly has an Id of 2.
  • We can find Curly's courses by looking in the StudentCourses table for the records that match his StudentId.

Example 2: Haskell Monads

  • "Haskell Monads" has an Id of 3.
  • We can find all the students enrolled in the Haskell Monads course by checking the CourseId column in the StudentCourses table.