8.1.1 From File-Based Storage to Relational Databases
File-based storage keeps data in separate files, often for separate tasks. A relational database stores related facts in tables that can be connected.
By the end of this page, you should be able to:
- define and use the key terms accurately;
- explain how the idea works using a new example;
- apply the idea to a database design or SQL task.
1. When separate files cause trouble
Imagine a sports centre keeps member details in both a door-entry file and a class-booking file. If a member changes their phone number, staff may update one file and miss the other. The records then disagree. Repeated copies also take extra storage and make changes slower.
2. How a relational database helps
A relational database stores each kind of fact in a suitable table. A Member table can hold each memberโs contact details once; a Booking table can hold each booking. A key in Booking can identify the member who made it. The DBMS can retrieve information from both tables when needed.
3. What improves, and what still needs care
Storing a fact once reduces unnecessary duplication and update errors. Shared access can make information available to different tasks. The design still needs sensible rules, accurate input, access controls and backups. A database is not automatically correct just because it uses tables.
Worked example
A climbing centre assigns MemberID 318 to Noor. A booking row stores BookingID 902 and MemberID 318. Noorโs telephone number is kept in Member once, even if she makes many bookings.
Common mistake to avoid
Do not say that a database eliminates all errors. It reduces some problems through structure and controls; people can still enter incorrect facts.
Interactive check
Choose an answer, read the explanation, and continue to the next example.
Independent practice
Try this original question before opening the suggested response.
A theatre stores a customer address separately in its ticket sales and mailing files. Explain two problems this can cause and one way a relational design could help. (4)
Suggested response
The address is duplicated, so storage is wasted. The copies can become inconsistent if one is changed and the other is not. A relational design can store the address once in Customer and link TicketSale to that customer with a key.
Answering clearly
Use the technical term, state what it does, and connect your explanation to the details in the question.