Multiple choiceQuestion 1 · Recall
Loading…
By the end you can explain what a file-based approach is, and describe several limitations of storing and retrieving data in separate files.
Imagine a school office with three programs. The reports program reads students.txt. The attendance program reads attendance.csv. The library program reads library.csv.
Each file was designed for one job, by one person, at one time. Nothing forces the three files to agree with each other.
That is the file-based approach: data is stored in separate files, and each application program knows the layout of the file it uses and reads or writes it directly.
Because every file is an island, the same fact gets copied, and copies drift apart. Here are the limitations examiners expect you to know.
| Limitation | What it looks like in practice |
|---|---|
| Data redundancy | The same data is stored in more than one file, wasting space. |
| Data inconsistency | A change is made in one copy but not the others, so the files disagree. |
| Program-data dependence | The file's structure is written into each program, so changing the file means changing the programs. |
| Difficult sharing and concurrent access | Two programs updating the same file at once can overwrite each other's changes. |
| Weak security | Access is controlled file by file, so it is hard to give one user access to some fields but not others. |
| Integrity is hard to enforce | Nothing stops a program writing an invalid value, such as a date of birth in the future. |
| No easy ad hoc queries | A new question means writing a new program, not just asking the data. |
You do not need all seven in every answer. Pick the ones the question's context makes relevant, and explain them with an example.
Worked example: The address that moved
A student's address is stored in students.txt and also in library.csv. The student moves house. The office updates students.txt but nobody updates the library file. What has gone wrong, and what could happen next?
A file-based system has no redundancy, because each file is separate.
Separation is exactly the problem. Each file keeps its own copy of shared facts such as names and addresses, so the same data is stored many times.
A spreadsheet is always a database.
A spreadsheet is a single file that a program opens directly. A relational database is managed by a database management system, which controls access, enforces rules and links tables through keys. The two can look similar on screen but behave very differently.
Program-data dependence just means the program needs the file to exist.
It means the program contains knowledge of the file's structure — field order, field widths, record layout. Change the structure and the program may read the wrong bytes or crash.
Suppose a program reads each student record as exactly 80 bytes: 30 for the name, 10 for the date of birth, 40 for the address. Those numbers live inside the program's code.
Now the school needs longer addresses, so the record becomes 100 bytes. The program still reads 80-byte records. Every record after the first is now read from the wrong position, and the output is nonsense.
In a database, the DBMS sits between the programs and the stored data. Programs ask for fields by name, such as Student.Forename, not by byte offset. The DBMS can change how the data is physically stored without the programs noticing. That separation is called data independence, and it is one of the main reasons databases replaced file-based systems.