24 min read
Relational Database
A relational database stores related facts in tables of rows and columns, linked by matching values.
There are different ways to organise stored data. The type used in this course — and in most business software — is the relational database.
It stores data in tables. Each table is a list of one type of thing. Related tables connect through matching values, such as MemberID.
Tables, rows, and columns
In a relational database, data sits in tables. A table has:
- Columns — the fields, such as FullName and City
- Rows — the records, one per member or one per book
Sophie Walsh is a person. Her row in Members is a record of her membership.
| Members | |||
|---|---|---|---|
| Books | ||
|---|---|---|
Why use separate tables
Why not one giant list with members and books mixed together?
Because a column must mean one thing. If members and books share one list, the Phone column holds a phone number on one row and an author's name on the next. Then the list cannot be trusted.
Separate tables keep each column honest. Members holds people. Books holds titles. Loans will later connect them.
| One mixed list — why it fails | ||
|---|---|---|
The same column holds a phone on one row and an author on the next. The City column is empty for books because a book has no city. Two tables fix this.
Three tables, two links
Loans stores MemberID and BookID — not "Sophie Walsh" and "The River Path" copied as text. The numbers relate the tables. Change Sophie's name in Members once; every loan still points at MemberID 1.
That linking through matching values is what relational means.
| Loans | ||||
|---|---|---|---|---|
Practice
Swipe or use the arrows to move between questions.
1 / 3
More lessons in Database Fundamentals · Next: What is a Table? · Previous: Database Management System
