A3.1.1 Relational databases: features, benefits and limits
SL + HLCommand term: Explain1. Tour of the school library database
A library keeps track of students, books, loans and reservations. Click Next to discover the features of a relational database one by one.
2. Why do people love relational databases?
Three mini-labs: (a) reduced redundancy and consistency, (b) integrity rules, (c) concurrency control.
(a) One fact, one place
Wei Chen has borrowed books and changes the name they use. Compare a spreadsheet (name copied on every row) with the database (name stored once, loans refer to the ID).
(b) The database says no (data integrity)
Try to break the data. Rules (primary keys, foreign keys, data types) protect it. The Students table has S1–S4, Books B1–B4; Wei (S1) has loans.
(c) Two librarians, one last copy (concurrency control)
Only 1 copy of "Logic Puzzles" is left. Librarian A and Librarian B both try to lend it at the same moment.
3. Where relational databases struggle
Pick a limitation and try the demo.
4. Flip-card deck
Click a card to flip it. Try saying the explanation before you flip!
5. Feature, benefit or limitation?
Ten statements. Classify each one. Streaks of 3+ score double.
6. 45-second speed round
Which feature solves the problem? Answer as many as you can before time runs out.
Learning objectives
By the end of this page you should be able to:
- Describe the features of a relational database: tables, primary keys, foreign keys, composite keys and relationships.
- Explain the benefits of relational databases, including data integrity, data consistency and reduced redundancy.
- Explain further benefits, including concurrency control, reliable transaction processing, scalability and security.
- Explain the limitations of relational databases, such as rigid schemas and handling unstructured or hierarchical data.
- Explain further limitations: big-data scalability, design complexity and object-relational impedance mismatch.
Features
- A relational database stores data in tables (also called relations). Each table is about one kind of thing (an entity, e.g. Student). A row (record / tuple) is one instance and a column (field / attribute) is one property with a fixed data type.
- A primary key (PK) is a field that uniquely identifies each record; it cannot be duplicated or NULL.
- A composite key is a primary key made from two or more fields together (e.g. StudentID + BookID). Neither field alone has to be unique.
- A foreign key (FK) is a field in one table that holds the primary-key value of a record in another table. It links the tables and is used to enforce referential integrity.
- Relationships connect tables: one-to-one, one-to-many (one student, many loans) and many-to-many (students books, solved with a linking table such as Loans).
Benefits
- Reduced redundancy / duplication: each fact is stored once, other tables refer to it with a key. Saves storage and avoids repeated typing.
- Data consistency: with one copy, an update is seen everywhere, so there are no conflicting versions.
- Data integrity: rules (PK uniqueness, FK existence, data types, constraints) make sure data is valid and accurate (no loan for a student who does not exist).
- Data retrieval: SQL, indexes and joins let you ask flexible questions and get fast, accurate results.
- Concurrency control: many users can read and write at the same time without corrupting each other's work (locking, transactions).
- Reliable transaction processing: a transaction is all-or-nothing (ACID: atomic, consistent, isolated, durable), so a crash cannot leave half a bank transfer.
- Security features: user accounts, access rights per table / view / column, encryption, auditing and backups.
- Scalability: can grow to large numbers of records and users (bigger servers, indexes, replication, partitioning).
- Community support: mature technology with a standard language (SQL), many free systems (MySQL, PostgreSQL, SQLite), documentation, tools and skilled people.
Limitations
- Scalability for “big data”: scaling up one server is costly; spreading joins and transactions over many servers is hard, so huge volumes or very high write rates can be a problem.
- Design complexity: good design needs entities, keys, relationships and normalisation; poor design causes anomalies, and many tables mean complex joins.
- Hierarchical data: trees (folders, organisation charts) need self-joins or recursive queries, which are awkward and slower.
- Rigid schema: every record in a table has the same fields and types; changing the structure affects all rows and the programs that use them.
- Object-relational impedance mismatch: programs use objects with nested data and inheritance; the database uses flat tables, so code must convert (map) between them.
- Unstructured data: images, video, free text, documents and varied JSON do not fit neatly in rows and columns and cannot easily be queried inside.
Writing an “Explain” answer
“Explain” needs a point + reason + link to the context. Not just “it reduces redundancy”, but “data is stored once and referenced by a foreign key so a change to a student's name is made in one place and every loan shows the same name”.
Use the 中文 button at the top to show or hide the Chinese terms.
| Term | 中文 | Meaning |
|---|
Choose an answer. You get instant feedback.
Score: 0 /
Write your answer first, then reveal the markscheme. These are exam-style practice questions written for this site.
1. Outline the purpose of a primary key in a relational database. [2]
2. Describe the role of a foreign key. [2]
3. A school keeps students' details in a spreadsheet, repeating the student name on every row of a book-loan list. Explain two benefits of moving to a relational database. [4]
4. Explain two limitations of using a relational database to store the posts, photos and video clips of a social-media app. [4]
5. Explain how a relational database supports concurrency and reliable transaction processing when two users update the same record. [4]
6. An online retailer is choosing a database for customer orders, product catalogue and millions of customer-review photos. Discuss whether a relational database is suitable. [6]