Flat File Database & Relational Database
- A database is a structured collection of data so it can be searched, sorted, filtered and analysed quickly
- Data in a database can be any type of data including text, images, videos, sound
- Databases use tables to store data
- Tables have records of data represented by one row
- In the example below, each row represents the data stored about a single customer (the customer’s record)
- In the customer table, there are 3 records
- Each record is divided into fields (CustomerID, FirstName, LastName, DOB and Phone Number)
A Database Table Containing Customer Details
|
|
|
|
PhoneNumber |
1 |
Andrea |
Bycroft |
05031976 |
0746762883 |
2 |
Melissa |
Langler |
22012001 |
0756372892 |
3 |
Amy |
George |
22111988 |
0746372821 |
- Fields are represented by the columns in a table
- There are 5 fields in the customer table
- The first row in a table contains the field names which is the heading for the data stored in that field
- Each field in a table has a data type which defines what data can be entered into that field
Flat File Database |
Relational Database |
|
Characteristics |
|
|
Uses |
|
|
Advantages |
|
|
Disadvantages |
|
|
Worked example
The owner of a gardening company is planning to create a database to store the details of all his customers. He has the choice of using a flat file database or a relational database.
Discuss the advantages and disadvantages of using a relational database rather than a flat file database.
[8]
Advantages of relational databases
Less data entry/data is stored only once / avoids duplication of data
Less inconsistency in data
Easier to edit data/records
Easier to edit data/record format
Easier to add/delete data/records
More complex queries can be carried out
Better security
More ability to cater for future requirements/expansion
Disadvantages of relational databases
More complex than a flat file database as more tables are required
Takes more time to set up
More of a reduction in performance if many tables are needed
Slower extraction of meaning from data
Less robust due to broken keys and records / each table requires a key field and relationships to other tables
More developer expertise/personnel to run the database:
More expensive to create a relational database
More processing power is needed for complex queries.
Advantages of flat file databases
All records are stored in one place
Easier to understand/use
Sorting is simpler
Filtering is simpler
Can be used with a spreadsheet / single table DBMS
Disadvantages of a flat file database
Data is more likely to be duplicated / difficult to stop duplication
Records can be duplicated and the flat file will not stop this
Harder to update
Every record in the database has to have the same fields, even though many are not used
Harder to change the data format
Harder to produce complex queries
Almost no security