Why Relational Databases?
Learn why tables and relationships became such a durable way to model data.
Relational databases became popular because they give you a simple way to store connected facts without repeating everything everywhere.
That may sound small, but it changes how reliably software can work with information.
SQLite is a relational database system. It stores data in tables and lets you connect rows using keys.
The problem: repeated facts drift apart
Imagine tracking bookstore orders in one big list:
order_id | customer_name | customer_email | book_title | quantity
-------- | ------------- | ------------------ | ------------ | --------
1001 | Maya Chen | maya@example.com | SQL Basics | 1
1002 | Maya Chen | maya@example.com | Data Stories | 2
1003 | Jordan Lee | jordan@example.com | SQL Basics | 1This looks convenient at first.
But what happens when Maya changes her email address?
You must update every row where Maya appears.
If one row is missed, the data disagrees with itself.
This is a duplication problem. The same fact lives in more than one place.
The relational answer
A relational database separates different kinds of facts into different tables, then connects them.
Instead of copying the full customer information into every order row, you store the customer once.
Then each order points to that customer.
customers
id | name | email
-- | ---------- | ----------------
1 | Maya Chen | maya@example.com
2 | Jordan Lee | jordan@example.com
orders
id | customer_id
---- | -----------
1001 | 1
1002 | 1
1003 | 2Now if Maya changes her email, there is one customer row to update.
Relationships use keys
A key is a value that identifies a row.
Most tables have a primary key, often named id.
Another table can store that id to create a relationship.
In this example:
customers.ididentifies one customer.orders.customer_idpoints to the customer who placed the order.
The relationship lets you ask questions across tables:
- Which orders belong to Maya?
- Which customers have placed no orders?
- How many orders has each customer placed?
Why is storing one customer row and pointing orders to it useful?
It requires copying the customer's email into every order forever
It makes customer changes happen in one place
It prevents all orders from having ids
It turns rows into pictures
One fact in one place
A useful relational design goal is:
Store each important fact in one place when you reasonably can.
That does not mean every database is perfect or every repeated value is wrong. It means you should notice when repeated facts can drift apart.
Relational does not mean spreadsheet
Tables may look like spreadsheets, but the relational model adds an important idea: relationships between tables are part of the design.
A spreadsheet can have multiple sheets, formulas, and lookups. A relational database is built around formally storing related sets of facts and querying across them.
Why this model lasted
The relational model became dominant because it is:
- simple enough to understand: tables, rows, columns
- strong enough to model real work: customers place orders, students enroll in classes, posts have comments
- flexible to query: you can combine facts in many ways later
- good at reducing duplication: one fact can live in one place
The main idea
Relational databases help you store connected facts without copying everything everywhere.
Tables hold one kind of thing. Keys identify rows. Relationships let rows refer to other rows.
That is why the model has lasted for decades.
Check your understanding
What is a primary key usually used for?
Decorating the table with a color
Identifying one row in a table
Choosing text color
Deleting every table automatically
What is a foreign key idea, in plain language?
A key that unlocks a physical door
A value in one table that points to a row in another table
A password written in another language
A chart title
Why did the relational model become so useful?
It requires every fact to be copied into every table
It can model connected facts while reducing repeated copies
It only stores images
It forbids questions across tables
What is the risk of copying the same customer email into many order rows?
The email will automatically update itself in every plain copied cell
The copies can drift apart when one is updated and another is missed
It makes tables impossible to create
It prevents SQL from reading rows