成人快手

Introducing databasesFlat file databases

Using flat file databases can lead to insertion, deletion and update anomalies. Use of relational databases where primary and foreign keys are used to link tables helps overcome these issues.

Part of Computing ScienceDatabase design and development

Flat file databases

A flat file database consists of one table. As a result, a large database will most likely have data which is unnecessarily repeated several times in the same table.

The table below holds data on teachers in a school. It also contains information about the department they work in.

IDForenameSurnameDepartmentDepartment IDPhone number
1ColinArthurICT001300
2LauraBrownICT001300
3StephenMacLeodICT001300
4ScottSinclairEnglish002301
5MichelleWieEnglish002301
6RossDyettPE003302
7IanAndersonPE003302
8BettyFloodGeography004303
ID1
ForenameColin
SurnameArthur
DepartmentICT
Department ID001
Phone number300
ID2
ForenameLaura
SurnameBrown
DepartmentICT
Department ID001
Phone number300
ID3
ForenameStephen
SurnameMacLeod
DepartmentICT
Department ID001
Phone number300
ID4
ForenameScott
SurnameSinclair
DepartmentEnglish
Department ID002
Phone number301
ID5
ForenameMichelle
SurnameWie
DepartmentEnglish
Department ID002
Phone number301
ID6
ForenameRoss
SurnameDyett
DepartmentPE
Department ID003
Phone number302
ID7
ForenameIan
SurnameAnderson
DepartmentPE
Department ID003
Phone number302
ID8
ForenameBetty
SurnameFlood
DepartmentGeography
Department ID004
Phone number303

In this flat file database, the data on each member of staff is held together with all data for each department.

This is unnecessary as some information is stored more than once (eg the same phone number). This also results in an increased file size for the database. Using flat file databases can lead to three very specific problems:

  • insert anomaly
  • delete anomaly
  • update anomaly